मैं इस त्रुटि हो रही है:कोणीय 2 और जैस्मीन: त्रुटि: अपने परीक्षण से पहले "TestBed.compileComponents" कॉल करें
Error: This test module uses the component MessagesComponent which is using a "templateUrl", but they were never compiled. Please call "TestBed.compileComponents" before your test.
जब यह सरल कोणीय परीक्षण चलाने की कोशिश कर 2 & जैस्मीन टेस्ट:
let comp: MessagesComponent;
let fixture: ComponentFixture<MessagesComponent>;
describe('MessagesComponent',() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ MessagesComponent ],
providers: [ {provide: DataService, useValue: {} } ]
})
.compileComponents(); // compile template and css
fixture = TestBed.createComponent(MessagesComponent);
comp = fixture.componentInstance;
});
it('example',() => {
expect("true").toEqual("true");
});
});
मुझे लगता है कि यह मेरे webpack परीक्षण विन्यास के साथ कुछ की वजह से हो सकता है:
'use strict';
const path = require('path');
const webpack = require('webpack');
module.exports = {
devtool: 'inline-source-map',
module: {
loaders: [
{ loader: 'raw', test: /\.(css|html)$/ },
{ exclude: /node_modules/, loader: 'ts', test: /\.ts$/ }
]
},
resolve: {
extensions: ['', '.js', '.ts'],
modulesDirectories: ['node_modules'],
root: path.resolve('.', 'src')
},
tslint: {
emitErrors: true
}
};
क्या मुझे इसे किसी भी तरह से (...) विधि बदलनी चाहिए? – commonSenseCode
केवल तभी यदि यह '() 'असीमित रूप से कुछ भी करता है, उदाहरण के लिए, यदि यह किसी सेवा से डेटा प्राप्त करता है। यह पूरी तरह से ठीक है अगर 'पहले से)() को अतुल्यकालिक होना चाहिए लेकिन 'it()' नहीं है। – pe8ter
अजीब मैंने पूछा क्योंकि मैं अपने मूल प्रश्न में पोस्ट किए गए एक ही त्रुटि संदेश को प्राप्त करता हूं लेकिन कम से कम अब यह कहता है कि 1 में से 1 विफल रहा – commonSenseCode