fragment-ts 1.0.19 ā 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/init.command.js +1 -1
- package/dist/cli/commands/test.command.d.ts +1 -0
- package/dist/cli/commands/test.command.d.ts.map +1 -1
- package/dist/cli/commands/test.command.js +132 -189
- package/dist/cli/commands/test.command.js.map +1 -1
- package/dist/testing/runner.d.ts +5 -2
- package/dist/testing/runner.d.ts.map +1 -1
- package/dist/testing/runner.js +110 -23
- package/dist/testing/runner.js.map +1 -1
- package/dist/web/application.d.ts.map +1 -1
- package/dist/web/application.js +1 -0
- package/dist/web/application.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/init.command.ts +1 -1
- package/src/cli/commands/test.command.ts +184 -191
- package/src/testing/runner.ts +138 -23
- package/src/web/application.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.command.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"test.command.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAkBlB,QAAQ;IAkJ7B,OAAO,CAAC,MAAM,CAAC,oBAAoB;CA6GpC"}
|
|
@@ -41,6 +41,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const child_process_1 = require("child_process");
|
|
43
43
|
const fs = __importStar(require("fs"));
|
|
44
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
44
45
|
class TestCommand {
|
|
45
46
|
static register(program) {
|
|
46
47
|
program
|
|
@@ -50,6 +51,7 @@ class TestCommand {
|
|
|
50
51
|
.option("--env <environment>", "Environment mode: dev (use src/) or prod (use dist/)", "auto")
|
|
51
52
|
.option("--pattern <pattern>", "Test file pattern", "**/*.spec.ts")
|
|
52
53
|
.option("--coverage", "Generate coverage report")
|
|
54
|
+
.option("--no-color", "Disable colored output")
|
|
53
55
|
.action(async (options) => {
|
|
54
56
|
await this.runTests(options);
|
|
55
57
|
});
|
|
@@ -81,7 +83,7 @@ class TestCommand {
|
|
|
81
83
|
useTypeScript = false;
|
|
82
84
|
mode = "production (dist/)";
|
|
83
85
|
basePath = "dist";
|
|
84
|
-
pattern = options.pattern.replace(
|
|
86
|
+
pattern = options.pattern.replace(/\.ts$/, ".js") || "**/*.spec.js";
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
89
|
// Auto-detect
|
|
@@ -95,216 +97,157 @@ class TestCommand {
|
|
|
95
97
|
useTypeScript = false;
|
|
96
98
|
mode = "auto-detected production (dist/)";
|
|
97
99
|
basePath = "dist";
|
|
98
|
-
pattern = options.pattern.replace(
|
|
100
|
+
pattern = options.pattern.replace(/\.ts$/, ".js") || "**/*.spec.js";
|
|
99
101
|
}
|
|
100
102
|
else {
|
|
101
103
|
console.log(chalk_1.default.red("No src/ or dist/ directory found. Run: fragment init"));
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
console.log(chalk_1.default.gray(` Mode: ${mode}
|
|
106
|
-
|
|
107
|
+
console.log(chalk_1.default.gray(` Mode: ${mode}`));
|
|
108
|
+
console.log(chalk_1.default.gray(` Pattern: ${basePath}/${pattern}`));
|
|
109
|
+
// Check if we need to use ts-node for TypeScript files
|
|
110
|
+
const tsConfigPath = path.join(cwd, "tsconfig.json");
|
|
111
|
+
const hasTsConfig = fs.existsSync(tsConfigPath);
|
|
112
|
+
// Create a simple runner script that uses our test runner module
|
|
113
|
+
const scriptContent = this.generateRunnerScript({
|
|
114
|
+
useTypeScript,
|
|
115
|
+
basePath,
|
|
116
|
+
pattern,
|
|
117
|
+
hasTsConfig,
|
|
118
|
+
tsConfigPath,
|
|
119
|
+
watchMode: options.watch,
|
|
120
|
+
coverage: options.coverage,
|
|
121
|
+
noColor: options.color === false,
|
|
122
|
+
});
|
|
123
|
+
const scriptPath = path.join(cwd, ".fragment-test-runner.js");
|
|
124
|
+
try {
|
|
125
|
+
fs.writeFileSync(scriptPath, scriptContent);
|
|
126
|
+
fs.chmodSync(scriptPath, "755");
|
|
127
|
+
// -----------------------
|
|
128
|
+
// Watch / Coverage / Single Run
|
|
129
|
+
// -----------------------
|
|
130
|
+
if (options.watch) {
|
|
131
|
+
console.log(chalk_1.default.green("\nš Watch mode enabled. Listening for changes...\n"));
|
|
132
|
+
const watcher = chokidar_1.default.watch(`${basePath}/**/*.spec.${useTypeScript ? "ts" : "js"}`, {
|
|
133
|
+
ignoreInitial: true,
|
|
134
|
+
});
|
|
135
|
+
const runTests = () => {
|
|
136
|
+
const proc = (0, child_process_1.spawn)("node", [scriptPath], { stdio: "inherit" });
|
|
137
|
+
proc.on("close", (code) => {
|
|
138
|
+
if (code !== 0)
|
|
139
|
+
console.log(chalk_1.default.red(`Test run exited with code ${code}`));
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
runTests(); // Initial run
|
|
143
|
+
watcher.on("all", (event, pathChanged) => {
|
|
144
|
+
console.log(chalk_1.default.blue(`\nš File changed (${event}): ${pathChanged}`));
|
|
145
|
+
runTests();
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (options.coverage) {
|
|
149
|
+
console.log(chalk_1.default.green("\nš Coverage enabled. Running tests with coverage...\n"));
|
|
150
|
+
const proc = (0, child_process_1.spawn)("npx", ["c8", "--reporter=lcov", "--reporter=text", "node", scriptPath], { stdio: "inherit" });
|
|
151
|
+
proc.on("close", (code) => process.exit(code || 0));
|
|
152
|
+
proc.on("error", (err) => {
|
|
153
|
+
console.error(chalk_1.default.red("Failed to run coverage:"), err);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const proc = (0, child_process_1.spawn)("node", [scriptPath], { stdio: "inherit" });
|
|
159
|
+
proc.on("close", (code) => process.exit(code || 0));
|
|
160
|
+
proc.on("error", (err) => {
|
|
161
|
+
console.error(chalk_1.default.red("Failed to run tests:"), err);
|
|
162
|
+
process.exit(1);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.error(chalk_1.default.red("Failed to create test runner:"), error.message);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
static generateRunnerScript(options) {
|
|
172
|
+
const { useTypeScript, basePath, pattern, hasTsConfig, tsConfigPath, noColor, } = options;
|
|
173
|
+
let runnerImportPath = "fragment-ts";
|
|
174
|
+
const possiblePaths = [
|
|
175
|
+
path.join(process.cwd(), "node_modules", "fragment-ts", "testing"),
|
|
176
|
+
path.join(process.cwd(), "node_modules", "fragment-ts", "dist", "testing"),
|
|
177
|
+
path.join(__dirname, "..", "..", "testing"),
|
|
178
|
+
];
|
|
179
|
+
let resolvedRunnerPath = runnerImportPath;
|
|
180
|
+
for (const testPath of possiblePaths) {
|
|
181
|
+
if (fs.existsSync(testPath + ".ts") || fs.existsSync(testPath + ".js")) {
|
|
182
|
+
resolvedRunnerPath = testPath;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return `
|
|
187
|
+
"use strict";
|
|
188
|
+
|
|
107
189
|
${useTypeScript ? "require('ts-node/register/transpile-only');" : ""}
|
|
108
190
|
require('reflect-metadata');
|
|
109
191
|
|
|
110
|
-
|
|
111
|
-
|
|
192
|
+
process.env.NODE_ENV = 'test';
|
|
193
|
+
${noColor ? "process.env.FORCE_COLOR = '0';" : "process.env.FORCE_COLOR = '1';"}
|
|
112
194
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
195
|
+
${hasTsConfig && useTypeScript
|
|
196
|
+
? `
|
|
197
|
+
try {
|
|
198
|
+
const tsNode = require('ts-node');
|
|
199
|
+
tsNode.register({
|
|
200
|
+
project: '${tsConfigPath}',
|
|
201
|
+
transpileOnly: true,
|
|
202
|
+
compilerOptions: {
|
|
203
|
+
module: 'commonjs',
|
|
204
|
+
target: 'ES2020',
|
|
205
|
+
esModuleInterop: true,
|
|
206
|
+
skipLibCheck: true
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
} catch (error) {}`
|
|
210
|
+
: ""}
|
|
121
211
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
testState.suites.push(suite);
|
|
126
|
-
testState.currentSuite = suite;
|
|
127
|
-
fn();
|
|
128
|
-
testState.currentSuite = null;
|
|
129
|
-
};
|
|
212
|
+
let testRunner;
|
|
213
|
+
try {
|
|
214
|
+
const testModule = require('${resolvedRunnerPath}');
|
|
130
215
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
216
|
+
if (testModule.getTestRunner) {
|
|
217
|
+
testRunner = testModule.getTestRunner();
|
|
218
|
+
} else if (testModule.TestRunner) {
|
|
219
|
+
testRunner = new testModule.TestRunner();
|
|
220
|
+
} else if (testModule.default && testModule.default.getTestRunner) {
|
|
221
|
+
testRunner = testModule.default.getTestRunner();
|
|
222
|
+
} else {
|
|
223
|
+
testRunner = testModule;
|
|
134
224
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
toBe(expected) {
|
|
141
|
-
if (actual !== expected) {
|
|
142
|
-
throw new Error(\`Expected \${actual} to be \${expected}\`);
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
toEqual(expected) {
|
|
146
|
-
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
147
|
-
throw new Error(\`Expected \${JSON.stringify(actual)} to equal \${JSON.stringify(expected)}\`);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
toBeTruthy() {
|
|
151
|
-
if (!actual) {
|
|
152
|
-
throw new Error(\`Expected \${actual} to be truthy\`);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
toBeFalsy() {
|
|
156
|
-
if (actual) {
|
|
157
|
-
throw new Error(\`Expected \${actual} to be falsy\`);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
toThrow(expectedError) {
|
|
161
|
-
let threw = false;
|
|
162
|
-
let error = null;
|
|
163
|
-
try {
|
|
164
|
-
actual();
|
|
165
|
-
} catch (e) {
|
|
166
|
-
threw = true;
|
|
167
|
-
error = e;
|
|
168
|
-
}
|
|
169
|
-
if (!threw) {
|
|
170
|
-
throw new Error('Expected function to throw');
|
|
171
|
-
}
|
|
172
|
-
if (expectedError && error.message !== expectedError) {
|
|
173
|
-
throw new Error(\`Expected error message "\${expectedError}" but got "\${error.message}"\`);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
toBeInstanceOf(expected) {
|
|
177
|
-
if (!(actual instanceof expected)) {
|
|
178
|
-
throw new Error(\`Expected \${actual} to be instance of \${expected.name}\`);
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
toContain(expected) {
|
|
182
|
-
if (!actual.includes(expected)) {
|
|
183
|
-
throw new Error(\`Expected \${actual} to contain \${expected}\`);
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
toHaveProperty(property, value) {
|
|
187
|
-
if (!(property in actual)) {
|
|
188
|
-
throw new Error(\`Expected object to have property \${property}\`);
|
|
189
|
-
}
|
|
190
|
-
if (value !== undefined && actual[property] !== value) {
|
|
191
|
-
throw new Error(\`Expected property \${property} to be \${value} but got \${actual[property]}\`);
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
toBeNull() {
|
|
195
|
-
if (actual !== null) {
|
|
196
|
-
throw new Error(\`Expected \${actual} to be null\`);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
toBeUndefined() {
|
|
200
|
-
if (actual !== undefined) {
|
|
201
|
-
throw new Error(\`Expected \${actual} to be undefined\`);
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
toHaveLength(expected) {
|
|
205
|
-
if (actual.length !== expected) {
|
|
206
|
-
throw new Error(\`Expected length \${expected} but got \${actual.length}\`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
};
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error('Failed to load test runner:', error.message);
|
|
227
|
+
console.error('Make sure fragment-ts is installed as a dependency');
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
211
230
|
|
|
212
231
|
async function runTests() {
|
|
213
232
|
try {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (files.length === 0) {
|
|
218
|
-
console.log('No test files found matching pattern: ${basePath}/${pattern}');
|
|
219
|
-
process.exit(0);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
console.log(\`Found \${files.length} test file(s)\\n\`);
|
|
223
|
-
|
|
224
|
-
// Load all test files
|
|
225
|
-
for (const file of files) {
|
|
226
|
-
require(path.resolve(file));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Run all tests
|
|
230
|
-
for (const suite of testState.suites) {
|
|
231
|
-
console.log(\`\\nš¦ \${suite.name}\`);
|
|
232
|
-
|
|
233
|
-
for (const test of suite.tests) {
|
|
234
|
-
try {
|
|
235
|
-
await test.fn();
|
|
236
|
-
console.log(\` ā \${test.name}\`);
|
|
237
|
-
testState.passed++;
|
|
238
|
-
} catch (error) {
|
|
239
|
-
console.log(\` ā \${test.name}\`);
|
|
240
|
-
console.error(\` \${error.message}\`);
|
|
241
|
-
testState.failed++;
|
|
242
|
-
testState.errors.push({
|
|
243
|
-
suite: suite.name,
|
|
244
|
-
test: test.name,
|
|
245
|
-
error: error.message,
|
|
246
|
-
stack: error.stack
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// Print summary
|
|
253
|
-
console.log(\`\\n\\nš Results: \${testState.passed} passed, \${testState.failed} failed\\n\`);
|
|
254
|
-
|
|
255
|
-
if (testState.failed > 0) {
|
|
256
|
-
console.log('\\nā Failed Tests:\\n');
|
|
257
|
-
testState.errors.forEach(err => {
|
|
258
|
-
console.log(\` \${err.suite} > \${err.test}\`);
|
|
259
|
-
console.log(\` \${err.error}\\n\`);
|
|
260
|
-
});
|
|
261
|
-
process.exit(1);
|
|
262
|
-
} else {
|
|
263
|
-
console.log('ā
All tests passed!\\n');
|
|
264
|
-
process.exit(0);
|
|
265
|
-
}
|
|
233
|
+
console.log('Looking for test files...');
|
|
234
|
+
await testRunner.loadTestFiles('${basePath}/${pattern}');
|
|
235
|
+
await testRunner.run();
|
|
266
236
|
} catch (error) {
|
|
267
|
-
console.error('Error running tests:', error);
|
|
237
|
+
console.error('\\nā Error running tests:', error.message);
|
|
238
|
+
if (error.stack && process.env.DEBUG) console.error(error.stack);
|
|
268
239
|
process.exit(1);
|
|
269
240
|
}
|
|
270
241
|
}
|
|
271
242
|
|
|
272
|
-
|
|
243
|
+
process.on('SIGINT', () => { console.log('\\n\\nTest run interrupted'); process.exit(130); });
|
|
244
|
+
process.on('SIGTERM', () => { console.log('\\n\\nTest run terminated'); process.exit(143); });
|
|
245
|
+
|
|
246
|
+
runTests().catch(error => {
|
|
247
|
+
console.error('Unhandled error:', error);
|
|
248
|
+
process.exit(1);
|
|
249
|
+
});
|
|
273
250
|
`;
|
|
274
|
-
const scriptPath = path.join(cwd, ".fragment-test-runner.js");
|
|
275
|
-
try {
|
|
276
|
-
fs.writeFileSync(scriptPath, scriptContent);
|
|
277
|
-
const nodeArgs = [scriptPath];
|
|
278
|
-
const env = {
|
|
279
|
-
...process.env,
|
|
280
|
-
TS_NODE_TRANSPILE_ONLY: "true",
|
|
281
|
-
NODE_ENV: "test",
|
|
282
|
-
};
|
|
283
|
-
const proc = (0, child_process_1.spawn)("node", nodeArgs, {
|
|
284
|
-
cwd,
|
|
285
|
-
stdio: "inherit",
|
|
286
|
-
env,
|
|
287
|
-
});
|
|
288
|
-
proc.on("close", (code) => {
|
|
289
|
-
try {
|
|
290
|
-
fs.unlinkSync(scriptPath);
|
|
291
|
-
}
|
|
292
|
-
catch { }
|
|
293
|
-
process.exit(code || 0);
|
|
294
|
-
});
|
|
295
|
-
proc.on("error", (error) => {
|
|
296
|
-
console.error(chalk_1.default.red("Failed to run tests:"), error);
|
|
297
|
-
try {
|
|
298
|
-
fs.unlinkSync(scriptPath);
|
|
299
|
-
}
|
|
300
|
-
catch { }
|
|
301
|
-
process.exit(1);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
catch (error) {
|
|
305
|
-
console.error(chalk_1.default.red("Failed to create test runner:"), error.message);
|
|
306
|
-
process.exit(1);
|
|
307
|
-
}
|
|
308
251
|
}
|
|
309
252
|
}
|
|
310
253
|
exports.TestCommand = TestCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.command.js","sourceRoot":"","sources":["../../../src/cli/commands/test.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,2CAA6B;AAC7B,iDAAsC;AACtC,uCAAyB;
|
|
1
|
+
{"version":3,"file":"test.command.js","sourceRoot":"","sources":["../../../src/cli/commands/test.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,2CAA6B;AAC7B,iDAAsC;AACtC,uCAAyB;AACzB,wDAAgC;AAEhC,MAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC9B,OAAO;aACJ,OAAO,CAAC,MAAM,CAAC;aACf,WAAW,CAAC,WAAW,CAAC;aACxB,MAAM,CA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,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;gBACvE,kBAAkB,GAAG,QAAQ,CAAC;gBAC9B,MAAM;YACR,CAAC;QACH,CAAC;QAED,OAAO;;;EAGT,aAAa,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;EAIlE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,gCAAgC;;EAG7E,WAAW,IAAI,aAAa;YAC1B,CAAC,CAAC;;;;gBAIU,YAAY;;;;;;;;;mBAST;YACf,CAAC,CAAC,EACN;;;;gCAIgC,kBAAkB;;;;;;;;;;;;;;;;;;;;sCAoBZ,QAAQ,IAAI,OAAO;;;;;;;;;;;;;;;;CAgBxD,CAAC;IACA,CAAC;CACF;AAlRD,kCAkRC"}
|
package/dist/testing/runner.d.ts
CHANGED
|
@@ -12,10 +12,13 @@ export declare class TestRunner {
|
|
|
12
12
|
private suites;
|
|
13
13
|
private passed;
|
|
14
14
|
private failed;
|
|
15
|
+
private errors;
|
|
15
16
|
describe(name: string, fn: () => void): void;
|
|
16
17
|
run(): Promise<void>;
|
|
17
18
|
loadTestFiles(pattern: string): Promise<void>;
|
|
18
19
|
}
|
|
20
|
+
export declare function getTestRunner(): TestRunner;
|
|
21
|
+
export declare function initTestRunner(): TestRunner;
|
|
19
22
|
export declare function describe(name: string, fn: () => void): void;
|
|
20
23
|
export declare function it(name: string, fn: () => void | Promise<void>): void;
|
|
21
24
|
export declare function beforeEach(fn: () => void | Promise<void>): void;
|
|
@@ -25,10 +28,10 @@ export declare function expect(actual: any): {
|
|
|
25
28
|
toEqual(expected: any): void;
|
|
26
29
|
toBeTruthy(): void;
|
|
27
30
|
toBeFalsy(): void;
|
|
28
|
-
toThrow(): void;
|
|
31
|
+
toThrow(expectedError?: string): void;
|
|
29
32
|
toBeInstanceOf(expected: any): void;
|
|
30
33
|
toContain(expected: any): void;
|
|
31
|
-
toHaveProperty(
|
|
34
|
+
toHaveProperty(property: string, value?: any): void;
|
|
32
35
|
toBeNull(): void;
|
|
33
36
|
toBeUndefined(): void;
|
|
34
37
|
toHaveLength(expected: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,cAAc,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAKD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAK;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,cAAc,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAKD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,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