@rspack/test-tools 1.5.7 → 1.6.0-beta.0

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.
Files changed (120) hide show
  1. package/dist/case/builtin.js +0 -22
  2. package/dist/case/cache.js +1 -2
  3. package/dist/case/common.js +48 -42
  4. package/dist/case/compiler.js +142 -124
  5. package/dist/case/config.js +1 -2
  6. package/dist/case/diagnostic.d.ts +2 -2
  7. package/dist/case/diagnostic.js +1 -2
  8. package/dist/case/error.d.ts +1 -0
  9. package/dist/case/error.js +61 -31
  10. package/dist/case/esm-output.d.ts +1 -0
  11. package/dist/case/esm-output.js +96 -0
  12. package/dist/case/example.d.ts +1 -0
  13. package/dist/case/example.js +57 -0
  14. package/dist/case/hash.js +3 -4
  15. package/dist/case/hook.js +45 -39
  16. package/dist/case/hot-step.d.ts +1 -1
  17. package/dist/case/hot-step.js +12 -10
  18. package/dist/case/hot.d.ts +5 -4
  19. package/dist/case/hot.js +33 -43
  20. package/dist/case/incremental.d.ts +1 -1
  21. package/dist/case/incremental.js +10 -10
  22. package/dist/case/index.d.ts +13 -1
  23. package/dist/case/index.js +9 -1
  24. package/dist/case/multi-compiler.d.ts +18 -0
  25. package/dist/case/multi-compiler.js +98 -0
  26. package/dist/case/normal.d.ts +2 -0
  27. package/dist/case/normal.js +19 -12
  28. package/dist/case/stats-api.d.ts +9 -0
  29. package/dist/case/stats-api.js +40 -29
  30. package/dist/case/stats-output.d.ts +10 -0
  31. package/dist/case/stats-output.js +10 -6
  32. package/dist/case/watch.d.ts +2 -4
  33. package/dist/case/watch.js +5 -11
  34. package/dist/compare/compare.js +6 -3
  35. package/dist/helper/directory.js +1 -1
  36. package/dist/helper/expect/error.js +1 -1
  37. package/dist/helper/expect/placeholder.js +7 -7
  38. package/dist/helper/expect/to-match-file-snapshot.d.ts +0 -1
  39. package/dist/helper/hot-update/plugin.d.ts +1 -1
  40. package/dist/helper/hot-update/plugin.js +10 -5
  41. package/dist/helper/legacy/LogTestPlugin.d.ts +6 -0
  42. package/dist/helper/legacy/LogTestPlugin.js +35 -0
  43. package/dist/helper/legacy/update.d.ts +2 -0
  44. package/dist/helper/legacy/update.esm.d.ts +1 -0
  45. package/dist/helper/legacy/update.esm.js +23 -0
  46. package/dist/helper/legacy/update.js +19 -0
  47. package/dist/helper/util/checkStats.d.ts +0 -1
  48. package/dist/helper/util/checkStats.js +0 -18
  49. package/dist/index.d.ts +0 -2
  50. package/dist/index.js +0 -2
  51. package/dist/jest/ignore-snapshot-default-reporter.d.ts +2 -0
  52. package/dist/jest/ignore-snapshot-default-reporter.js +57 -0
  53. package/dist/jest/ignore-snapshot-summary-reporter.d.ts +2 -0
  54. package/dist/jest/ignore-snapshot-summary-reporter.js +24 -0
  55. package/dist/jest/patch-node-env.d.ts +5 -0
  56. package/dist/jest/patch-node-env.js +18 -0
  57. package/dist/jest/slash.d.ts +2 -0
  58. package/dist/jest/slash.js +16 -0
  59. package/dist/runner/node/index.js +15 -7
  60. package/dist/runner/web/fake.js +6 -3
  61. package/dist/runner/web/jsdom.js +1 -5
  62. package/dist/test/creator.d.ts +12 -11
  63. package/dist/test/creator.js +52 -44
  64. package/dist/test/tester.js +14 -5
  65. package/dist/type.d.ts +10 -0
  66. package/package.json +13 -10
  67. package/dist/helper/legacy/createLogger.d.ts +0 -23
  68. package/dist/helper/legacy/createLogger.js +0 -20
  69. package/dist/helper/legacy/supportsBlob.d.ts +0 -2
  70. package/dist/helper/legacy/supportsBlob.js +0 -10
  71. package/dist/helper/legacy/supportsClassFields.d.ts +0 -2
  72. package/dist/helper/legacy/supportsClassFields.js +0 -11
  73. package/dist/helper/legacy/supportsES6.d.ts +0 -2
  74. package/dist/helper/legacy/supportsES6.js +0 -11
  75. package/dist/helper/legacy/supportsForOf.d.ts +0 -2
  76. package/dist/helper/legacy/supportsForOf.js +0 -11
  77. package/dist/helper/legacy/supportsIteratorDestructuring.d.ts +0 -2
  78. package/dist/helper/legacy/supportsIteratorDestructuring.js +0 -11
  79. package/dist/helper/legacy/supportsLogicalAssignment.d.ts +0 -2
  80. package/dist/helper/legacy/supportsLogicalAssignment.js +0 -11
  81. package/dist/helper/legacy/supportsObjectDestructuring.d.ts +0 -2
  82. package/dist/helper/legacy/supportsObjectDestructuring.js +0 -11
  83. package/dist/helper/legacy/supportsOptionalCatchBinding.d.ts +0 -2
  84. package/dist/helper/legacy/supportsOptionalCatchBinding.js +0 -11
  85. package/dist/helper/legacy/supportsOptionalChaining.d.ts +0 -2
  86. package/dist/helper/legacy/supportsOptionalChaining.js +0 -11
  87. package/dist/helper/legacy/supportsRequireInModule.d.ts +0 -2
  88. package/dist/helper/legacy/supportsRequireInModule.js +0 -5
  89. package/dist/helper/legacy/supportsResponse.d.ts +0 -2
  90. package/dist/helper/legacy/supportsResponse.js +0 -10
  91. package/dist/helper/legacy/supportsSpread.d.ts +0 -2
  92. package/dist/helper/legacy/supportsSpread.js +0 -12
  93. package/dist/helper/legacy/supportsTemplateStrings.d.ts +0 -2
  94. package/dist/helper/legacy/supportsTemplateStrings.js +0 -11
  95. package/dist/helper/legacy/supportsWebAssembly.d.ts +0 -2
  96. package/dist/helper/legacy/supportsWebAssembly.js +0 -10
  97. package/dist/helper/legacy/supportsWorker.d.ts +0 -2
  98. package/dist/helper/legacy/supportsWorker.js +0 -17
  99. package/dist/helper/legacy/warmup-webpack.d.ts +0 -1
  100. package/dist/helper/legacy/warmup-webpack.js +0 -26
  101. package/dist/helper/loaders/hot-update.d.ts +0 -1
  102. package/dist/helper/loaders/hot-update.js +0 -40
  103. package/dist/helper/plugins/hot-update.d.ts +0 -7
  104. package/dist/helper/plugins/hot-update.js +0 -40
  105. package/dist/helper/plugins/index.d.ts +0 -1
  106. package/dist/helper/plugins/index.js +0 -17
  107. package/dist/helper/util/currentWatchStep.d.ts +0 -1
  108. package/dist/helper/util/currentWatchStep.js +0 -2
  109. package/dist/helper/util/identifier.d.ts +0 -76
  110. package/dist/helper/util/identifier.js +0 -339
  111. package/dist/helper/util/replaceMitteDiagnostic.d.ts +0 -2
  112. package/dist/helper/util/replaceMitteDiagnostic.js +0 -17
  113. package/dist/reporter/diff-html.d.ts +0 -15
  114. package/dist/reporter/diff-html.js +0 -69
  115. package/dist/reporter/diff-stats.d.ts +0 -24
  116. package/dist/reporter/diff-stats.js +0 -131
  117. package/dist/reporter/index.d.ts +0 -2
  118. package/dist/reporter/index.js +0 -18
  119. package/dist/test/simple.d.ts +0 -5
  120. package/dist/test/simple.js +0 -44
@@ -16,31 +16,35 @@ class BasicCaseCreator {
16
16
  this.currentConcurrent = 0;
17
17
  this.tasks = [];
18
18
  }
19
- create(name, src, dist, temp) {
19
+ create(name, src, dist, temp, caseOptions) {
20
+ const options = {
21
+ ...this._options,
22
+ ...caseOptions
23
+ };
20
24
  const testConfig = this.readTestConfig(src);
21
- if (typeof this._options.testConfig === "function") {
22
- this._options.testConfig(testConfig);
25
+ if (typeof options.testConfig === "function") {
26
+ options.testConfig(testConfig);
23
27
  }
24
- const skipped = this.checkSkipped(src, testConfig);
28
+ const skipped = this.checkSkipped(src, testConfig, options);
25
29
  if (skipped) {
26
30
  this.skip(name, skipped);
27
31
  return;
28
32
  }
29
- if (this._options.clean) {
33
+ if (options.clean) {
30
34
  this.clean([dist, temp || ""].filter(Boolean));
31
35
  }
32
36
  const run = this.shouldRun(name);
33
- const tester = this.createTester(name, src, dist, temp, testConfig);
37
+ const tester = this.createTester(name, src, dist, temp, testConfig, options);
34
38
  const concurrent = process.env.WASM
35
39
  ? false
36
- : testConfig.concurrent || this._options.concurrent;
37
- if (this._options.describe) {
40
+ : testConfig.concurrent || options.concurrent;
41
+ if (options.describe) {
38
42
  if (run) {
39
43
  if (concurrent) {
40
- describe(name, () => this.describeConcurrent(name, tester, testConfig));
44
+ describe(name, () => this.describeConcurrent(name, tester, testConfig, options));
41
45
  }
42
46
  else {
43
- describe(name, () => this.describe(name, tester, testConfig));
47
+ describe(name, () => this.describe(name, tester, testConfig, options));
44
48
  }
45
49
  }
46
50
  else {
@@ -52,10 +56,10 @@ class BasicCaseCreator {
52
56
  else {
53
57
  if (run) {
54
58
  if (concurrent) {
55
- this.describeConcurrent(name, tester, testConfig);
59
+ this.describeConcurrent(name, tester, testConfig, options);
56
60
  }
57
61
  else {
58
- this.describe(name, tester, testConfig);
62
+ this.describe(name, tester, testConfig, options);
59
63
  }
60
64
  }
61
65
  else {
@@ -71,7 +75,7 @@ class BasicCaseCreator {
71
75
  }
72
76
  return name.includes(global.testFilter);
73
77
  }
74
- describeConcurrent(name, tester, testConfig) {
78
+ describeConcurrent(name, tester, testConfig, options) {
75
79
  beforeAll(async () => {
76
80
  await tester.prepare();
77
81
  });
@@ -79,7 +83,7 @@ class BasicCaseCreator {
79
83
  let chain = new Promise((resolve, reject) => {
80
84
  starter = resolve;
81
85
  });
82
- const ender = this.registerConcurrentTask(name, starter);
86
+ const ender = this.registerConcurrentTask(name, starter, options.concurrent);
83
87
  const env = this.createConcurrentEnv();
84
88
  for (let index = 0; index < tester.total; index++) {
85
89
  let stepSignalResolve = null;
@@ -88,8 +92,8 @@ class BasicCaseCreator {
88
92
  }).catch(() => {
89
93
  // prevent unhandled rejection
90
94
  });
91
- const description = typeof this._options.description === "function"
92
- ? this._options.description(name, index)
95
+ const description = typeof options.description === "function"
96
+ ? options.description(name, index)
93
97
  : index
94
98
  ? `step [${index}] should pass`
95
99
  : "should pass";
@@ -97,7 +101,7 @@ class BasicCaseCreator {
97
101
  stepSignal.then((e) => {
98
102
  cb(e);
99
103
  });
100
- }, this._options.timeout || 180000);
104
+ }, options.timeout || 300000);
101
105
  chain = chain.then(async () => {
102
106
  try {
103
107
  env.clear();
@@ -136,22 +140,28 @@ class BasicCaseCreator {
136
140
  await tester.resume();
137
141
  });
138
142
  }
139
- describe(name, tester, testConfig) {
143
+ describe(name, tester, testConfig, options) {
140
144
  beforeAll(async () => {
141
145
  await tester.prepare();
142
146
  });
143
147
  let bailout = false;
144
148
  for (let index = 0; index < tester.total; index++) {
145
- const description = typeof this._options.description === "function"
146
- ? this._options.description(name, index)
147
- : `step ${index ? `[${index}]` : ""} should pass`;
149
+ const description = typeof options.description === "function"
150
+ ? options.description(name, index)
151
+ : `step [${index}] should pass`;
148
152
  it(description, async () => {
149
153
  if (bailout) {
150
154
  throw `Case "${name}" step ${index + 1} bailout because ${tester.step + 1} failed`;
151
155
  }
152
- await tester.compile();
153
- await tester.check(env);
154
156
  const context = tester.getContext();
157
+ try {
158
+ await tester.compile();
159
+ }
160
+ catch (e) {
161
+ bailout = true;
162
+ context.emitError(name, e);
163
+ }
164
+ await tester.check(env);
155
165
  if (!tester.next() && context.hasError()) {
156
166
  bailout = true;
157
167
  const errors = context
@@ -160,8 +170,8 @@ class BasicCaseCreator {
160
170
  .join("\n\n");
161
171
  throw new Error(`Case "${name}" failed at step ${tester.step + 1}:\n${errors}`);
162
172
  }
163
- }, this._options.timeout || 30000);
164
- const env = this.createEnv(testConfig);
173
+ }, options.timeout || 60000);
174
+ const env = this.createEnv(testConfig, options);
165
175
  }
166
176
  afterAll(async () => {
167
177
  await tester.resume();
@@ -230,8 +240,8 @@ class BasicCaseCreator {
230
240
  jest
231
241
  };
232
242
  }
233
- createEnv(testConfig) {
234
- if (this._options.runner && !testConfig.noTests) {
243
+ createEnv(testConfig, options) {
244
+ if (options.runner && !testConfig.noTests) {
235
245
  return (0, createLazyTestEnv_1.default)(10000);
236
246
  }
237
247
  return {
@@ -245,7 +255,6 @@ class BasicCaseCreator {
245
255
  clean(folders) {
246
256
  for (const f of folders) {
247
257
  (0, rimraf_1.rimrafSync)(f);
248
- node_fs_1.default.mkdirSync(f, { recursive: true });
249
258
  }
250
259
  }
251
260
  skip(name, reason) {
@@ -257,30 +266,31 @@ class BasicCaseCreator {
257
266
  const testConfigFile = node_path_1.default.join(src, "test.config.js");
258
267
  return node_fs_1.default.existsSync(testConfigFile) ? require(testConfigFile) : {};
259
268
  }
260
- checkSkipped(src, testConfig) {
269
+ checkSkipped(src, testConfig, options) {
261
270
  const filterPath = node_path_1.default.join(src, "test.filter.js");
262
271
  // no test.filter.js, should not skip
263
272
  if (!node_fs_1.default.existsSync(filterPath)) {
264
273
  return false;
265
274
  }
266
275
  // test.filter.js exists, skip if it returns false|string|array
267
- const filtered = require(filterPath)(this._options, testConfig);
276
+ const filtered = require(filterPath)(options, testConfig);
268
277
  if (typeof filtered === "string" || Array.isArray(filtered)) {
269
278
  return true;
270
279
  }
271
280
  return !filtered;
272
281
  }
273
- createTester(name, src, dist, temp, testConfig) {
282
+ createTester(name, src, dist, temp, testConfig, options) {
274
283
  return new tester_1.Tester({
275
284
  name,
276
285
  src,
277
286
  dist,
278
287
  temp,
279
288
  testConfig,
280
- contextValue: this._options.contextValue,
281
- runnerCreator: this._options.runner,
282
- steps: this._options.steps({
283
- ...this._options,
289
+ contextValue: options.contextValue,
290
+ runnerCreator: options.runner,
291
+ createContext: options.createContext,
292
+ steps: options.steps({
293
+ ...options,
284
294
  name,
285
295
  src,
286
296
  dist,
@@ -288,25 +298,23 @@ class BasicCaseCreator {
288
298
  })
289
299
  });
290
300
  }
291
- tryRunTask() {
301
+ tryRunTask(concurrent) {
292
302
  while (this.tasks.length !== 0 &&
293
- this.currentConcurrent < this.getMaxConcurrent()) {
303
+ this.currentConcurrent < this.getMaxConcurrent(concurrent)) {
294
304
  const [_name, starter] = this.tasks.shift();
295
305
  this.currentConcurrent++;
296
306
  starter();
297
307
  }
298
308
  }
299
- getMaxConcurrent() {
300
- return typeof this._options.concurrent === "number"
301
- ? this._options.concurrent
302
- : DEFAULT_MAX_CONCURRENT;
309
+ getMaxConcurrent(concurrent) {
310
+ return typeof concurrent === "number" ? concurrent : DEFAULT_MAX_CONCURRENT;
303
311
  }
304
- registerConcurrentTask(name, starter) {
312
+ registerConcurrentTask(name, starter, concurrent) {
305
313
  this.tasks.push([name, starter]);
306
- this.tryRunTask();
314
+ this.tryRunTask(concurrent);
307
315
  return () => {
308
316
  this.currentConcurrent--;
309
- this.tryRunTask();
317
+ this.tryRunTask(concurrent);
310
318
  };
311
319
  }
312
320
  }
@@ -12,7 +12,9 @@ class Tester {
12
12
  this.steps = [];
13
13
  this.step = 0;
14
14
  this.total = 0;
15
- this.context = new context_1.TestContext(config);
15
+ this.context = config.createContext
16
+ ? config.createContext(config)
17
+ : new context_1.TestContext(config);
16
18
  this.steps = config.steps || [];
17
19
  this.step = 0;
18
20
  this.total = config.steps?.length || 0;
@@ -69,9 +71,9 @@ class Tester {
69
71
  for (const i of this.steps) {
70
72
  if (typeof i.afterAll === "function") {
71
73
  await i.afterAll(this.context);
72
- await this.context.closeCompiler(this.config.name);
73
74
  }
74
75
  }
76
+ await this.context.closeCompiler(this.config.name);
75
77
  }
76
78
  async runStepMethods(step, methods, force = false) {
77
79
  for (const i of methods) {
@@ -88,11 +90,18 @@ class Tester {
88
90
  }
89
91
  }
90
92
  async runCheckStepMethods(step, env, methods) {
91
- for (const i of methods) {
92
- if (typeof step[i] === "function") {
93
- await step[i](env, this.context);
93
+ try {
94
+ for (const i of methods) {
95
+ if (typeof step[i] === "function") {
96
+ await step[i](env, this.context);
97
+ }
94
98
  }
95
99
  }
100
+ catch (e) {
101
+ const errors = this.context.getError(this.config.name);
102
+ console.error(new Error([...errors, e].map(e => e.message).join("\n")));
103
+ throw e;
104
+ }
96
105
  }
97
106
  }
98
107
  exports.Tester = Tester;
package/dist/type.d.ts CHANGED
@@ -54,6 +54,7 @@ export interface ITesterConfig {
54
54
  compilerFactories?: TCompilerFactories<ECompilerType>;
55
55
  contextValue?: Record<string, unknown>;
56
56
  runnerCreator?: TTestRunnerCreator;
57
+ createContext?: (config: ITesterConfig) => ITestContext;
57
58
  }
58
59
  export interface ITester {
59
60
  step: number;
@@ -150,6 +151,7 @@ export type TTestConfig<T extends ECompilerType> = {
150
151
  concurrent?: boolean;
151
152
  snapshotContent?(content: string): string;
152
153
  checkSteps?: boolean;
154
+ ignoreNotFriendlyForIncrementalWarnings?: boolean;
153
155
  };
154
156
  export type TTestFilter<T extends ECompilerType> = (creatorConfig: Record<string, unknown>, testConfig: TTestConfig<T>) => boolean | string;
155
157
  export interface ITestRunner {
@@ -199,3 +201,11 @@ export type TTestRunnerCreator = {
199
201
  key: (context: ITestContext, name: string, file: string) => string;
200
202
  runner: (context: ITestContext, name: string, file: string, env: ITestEnv) => ITestRunner;
201
203
  };
204
+ declare global {
205
+ var __TEST_PATH__: string;
206
+ var __TEST_FIXTURES_PATH__: string;
207
+ var __TEST_DIST_PATH__: string;
208
+ var __ROOT_PATH__: string;
209
+ var __RSPACK_PATH__: string;
210
+ var __RSPACK_TEST_TOOLS_PATH__: string;
211
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/test-tools",
3
- "version": "1.5.7",
3
+ "version": "1.6.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "Test tools for rspack",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,8 @@
15
15
  "./package.json": "./package.json",
16
16
  "./helper/*": "./dist/helper/*.js",
17
17
  "./helper/legacy/*": "./dist/helper/legacy/*.js",
18
- "./helper/util/*": "./dist/helper/util/*.js"
18
+ "./helper/util/*": "./dist/helper/util/*.js",
19
+ "./jest/*": "./dist/jest/*.js"
19
20
  },
20
21
  "files": [
21
22
  "client",
@@ -39,8 +40,9 @@
39
40
  "@babel/parser": "7.28.4",
40
41
  "@babel/traverse": "7.28.4",
41
42
  "@babel/types": "7.28.4",
42
- "cross-env": "^10.0.0",
43
- "csv-to-markdown-table": "^1.5.0",
43
+ "@jest/reporters": "29.7.0",
44
+ "cross-env": "^10.1.0",
45
+ "csv-to-markdown-table": "1.5.0",
44
46
  "deepmerge": "^4.3.1",
45
47
  "filenamify": "4.3.0",
46
48
  "fs-extra": "^11.3.2",
@@ -49,8 +51,9 @@
49
51
  "iconv-lite": "^0.6.3",
50
52
  "jest-diff": "^29.7.0",
51
53
  "jest-snapshot": "29.7.0",
54
+ "jest-environment-node": "29.7.0",
52
55
  "jsdom": "^26.1.0",
53
- "memfs": "4.38.2",
56
+ "memfs": "4.48.1",
54
57
  "loader-utils": "^2.0.4",
55
58
  "path-serializer": "0.5.1",
56
59
  "pretty-format": "29.7.0",
@@ -62,7 +65,7 @@
62
65
  "webpack-sources": "3.3.3"
63
66
  },
64
67
  "devDependencies": {
65
- "@rspack/plugin-preact-refresh": "1.1.2",
68
+ "@rspack/plugin-preact-refresh": "1.1.3",
66
69
  "@rspack/plugin-react-refresh": "^1.5.1",
67
70
  "@swc/helpers": "0.5.17",
68
71
  "@swc/plugin-remove-console": "^9.1.0",
@@ -96,14 +99,14 @@
96
99
  "source-map-loader": "^5.0.0",
97
100
  "style-loader": "^4.0.0",
98
101
  "terser": "5.43.1",
99
- "typescript": "^5.9.2",
102
+ "typescript": "^5.9.3",
100
103
  "wast-loader": "^1.14.1",
101
104
  "worker-rspack-loader": "^3.1.2",
102
105
  "exports-loader": "^5.0.0",
103
- "@rspack/cli": "1.5.7",
104
- "@rspack/test-tools": "1.5.7",
106
+ "@rspack/core": "1.6.0-beta.0",
107
+ "@rspack/cli": "1.6.0-beta.0",
105
108
  "@rspack/binding-testing": "1.4.1",
106
- "@rspack/core": "1.5.7"
109
+ "@rspack/test-tools": "1.6.0-beta.0"
107
110
  },
108
111
  "peerDependencies": {
109
112
  "@rspack/core": ">=1.0.0"
@@ -1,23 +0,0 @@
1
- declare function _exports(appendTarget: any): {
2
- log: (l: any) => any;
3
- debug: (l: any) => any;
4
- trace: (l: any) => any;
5
- info: (l: any) => any;
6
- warn: {
7
- (...data: any[]): void;
8
- (message?: any, ...optionalParams: any[]): void;
9
- };
10
- error: {
11
- (...data: any[]): void;
12
- (message?: any, ...optionalParams: any[]): void;
13
- };
14
- logTime: () => void;
15
- group: () => void;
16
- groupCollapsed: () => void;
17
- groupEnd: () => void;
18
- profile: () => void;
19
- profileEnd: () => void;
20
- clear: () => void;
21
- status: () => void;
22
- };
23
- export = _exports;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = appendTarget => {
4
- return {
5
- log: l => appendTarget.push(l),
6
- debug: l => appendTarget.push(l),
7
- trace: l => appendTarget.push(l),
8
- info: l => appendTarget.push(l),
9
- warn: console.warn.bind(console),
10
- error: console.error.bind(console),
11
- logTime: () => { },
12
- group: () => { },
13
- groupCollapsed: () => { },
14
- groupEnd: () => { },
15
- profile: () => { },
16
- profileEnd: () => { },
17
- clear: () => { },
18
- status: () => { }
19
- };
20
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsBlob() {
4
- try {
5
- return typeof Blob !== "undefined";
6
- }
7
- catch (_err) {
8
- return false;
9
- }
10
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsES6() {
4
- try {
5
- eval("class A { #field = 1 }");
6
- return true;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsES6() {
4
- try {
5
- eval("class A {}");
6
- return true;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportDefaultAssignment() {
4
- try {
5
- var f = eval("(function f() { for(var x of ['ok', 'fail']) return x; })");
6
- return f() === "ok";
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsIteratorDestructuring() {
4
- try {
5
- var f = eval("(function f([, x, ...y]) { return x; })");
6
- return f([1, 2]) === 2;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): any;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsLogicalAssignment() {
4
- try {
5
- var f = eval("(function f() { var x = null; x ??= true; x &&= true; return x ||= false; })");
6
- return f();
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsObjectDestructuring() {
4
- try {
5
- var f = eval("(function f({x, y}) { return x + y; })");
6
- return f({ x: 1, y: 2 }) === 3;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsOptionalCatchBinding() {
4
- try {
5
- eval("try {} catch {}");
6
- return true;
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): any;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- // @ts-nocheck
2
- "use strict";
3
- module.exports = function supportsOptionalChaining() {
4
- try {
5
- const f = eval("(function f() { return ({a: true}) ?.a })");
6
- return f();
7
- }
8
- catch (_err) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsRequireInModule() {
4
- return !!require("module").createRequire;
5
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsResponse() {
4
- try {
5
- return typeof Response !== "undefined";
6
- }
7
- catch (_err) {
8
- return false;
9
- }
10
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): any;
2
- export = _exports;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsSpread() {
4
- try {
5
- var x = { a: true }, y; // eslint-disable-line no-unused-vars
6
- eval("y = { ...x }");
7
- return y !== x && y.a;
8
- }
9
- catch (e) {
10
- return false;
11
- }
12
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsTemplateStrings() {
4
- try {
5
- var f = eval("(function f() { return String.raw`a\\b`; })");
6
- return f() === "a\\b";
7
- }
8
- catch (e) {
9
- return false;
10
- }
11
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- module.exports = function supportsWebAssembly() {
4
- try {
5
- return typeof WebAssembly !== "undefined";
6
- }
7
- catch (e) {
8
- return false;
9
- }
10
- };
@@ -1,2 +0,0 @@
1
- declare function _exports(): boolean;
2
- export = _exports;