When i carry out the angular test of the angularjs,i caught this error You may need an appropriate loader to handle this file type. | @import '../../sass/conf/conf'; | @import '../../components/baMsgCenter/baMsgCenter'; | at karma-shim.js:174003
//webpack.test.js
var webpack = require('webpack');
var helpers = require('./config/helpers');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'inline-source-map',
resolve: {
extensions: ['.ts', '.js']
},
entry: {
},
module: {
rules: [
{
test: /\.ts$/,
loaders: [
{
loader: 'awesome-typescript-loader',
options: { configFileName: helpers.root('src', 'tsconfig.json') }
}, 'angular2-template-loader'
]
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'null-loader'
},
{
test: /\.css$/,
exclude: helpers.root('src', 'app'),
loader: 'null-loader'
},
{
test: /\.css$/,
include: helpers.root('src', 'app'),
loader: 'raw-loader'
}
]
},
plugins: [
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
helpers.root('./src'), // location of your src
{} // a map of your routes
)
]
}
//strategyTables.component.spec.ts
describe('StrategyTables test',()=> {
var comp:StrategyTables;
var fixture:ComponentFixture<StrategyTables>;
var de: DebugElement;
var el: HTMLElement;
beforeEach(async(()=>{
TestBed.configureTestingModule({
declarations:[StrategyTables],
imports:[
FormsModule,
PaginationModule,
CommonModule,
NgaModule,
Ng2SmartTableModule,
DropdownModule,
ModalModule
//StrategysModule
],
providers:[
{provide:StrategyTablesService,useClass:MockStrategyTablesService},
{provide:Router,useClass:RouterStub},
{provide:Location,useClass:MockLocation}
]
}).compileComponents();
}));
beforeEach(()=>{
fixture = TestBed.createComponent(StrategyTables);
comp = fixture.componentInstance;
});
it('test function',()=>{
comp.getById(1);
expect(comp.detail.name).toEqual("aaa");
});
});
I don't know what result to it,and how to fix it.Does someone has encountered such problems, or know how to solve it?
Aucun commentaire:
Enregistrer un commentaire