UNPKG

awesome-typescript-loader

Version:
89 lines (78 loc) 3.17 kB
"use strict"; var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments)).next()); }); }; var utils_1 = require('./utils'); describe('checker test', function () { this.timeout(5000); var fixture = new utils_1.Fixture("\n let a: string;\n function check(arg1: string) { }\n check(a);\n ", '.ts'); var config = utils_1.createConfig({ entry: fixture.path() }, { watch: true }); it('should watch changes', function () { return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() { var watcher, _a, err, stats, _b; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return utils_1.cleanOutputDir(); case 2: _context.next = 4; return utils_1.watch(config); case 4: watcher = _context.sent; _context.next = 7; return watcher.wait(); case 7: _a = _context.sent; err = _a[0]; stats = _a[1]; utils_1.expect(err).not.ok; utils_1.expect(stats.compilation.errors).lengthOf(0); fixture.update(function (text) { return text.replace('let a: string;', 'let a: number;'); }); _context.next = 15; return watcher.wait(); case 15: _b = _context.sent; err = _b[0]; stats = _b[1]; utils_1.expect(err).not.ok; utils_1.expect(stats.compilation.errors).lengthOf(1); watcher.close(); case 21: case 'end': return _context.stop(); } } }, _callee, this); })); }); }); //# sourceMappingURL=watch-type-errors.js.map