更新前端静态网页获取方式,放弃使用后端获取api

This commit is contained in:
2025-09-09 10:47:51 +08:00
parent 6889ca37e5
commit 44a4f1bae1
25558 changed files with 2463152 additions and 153 deletions

View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

View File

@@ -0,0 +1,2 @@
# Enforce `lf` for text files (even on Windows)
text eol=lf

250
frontend/node_modules/@bcoe/v8-coverage/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,250 @@
## Next
- **[Breaking change]** Replace `OutModules` enum by custom compiler option `mjsModule`.
- **[Breaking change]** Drop support for Pug, Sass, Angular & Webpack.
- **[Feature]** Expose custom registries for each target.
- **[Feature]** Add `dist.tscOptions` for `lib` target to override options for
distribution builds.
- **[Feature]** Native ESM tests with mocha.
- **[Fix]** Disable deprecated TsLint rules from the default config
- **[Fix]** Remove use of experimental `fs/promises` module.
- **[Internal]** Fix continuous deployment script (stop confusing PRs to master
with push to master)
- **[Internal]** Update dependencies
- **[Internal]** Fix deprecated Mocha types.
## 0.17.1 (2017-05-03)
- **[Fix]** Update dependencies, remove `std/esm` warning.
## 0.17.0 (2017-04-22)
- **[Breaking change]** Update dependencies. Use `esm` instead of `@std/esm`, update Typescript to `2.8.3`.
- **[Fix]** Fix Node processes spawn on Windows (Mocha, Nyc)
## 0.16.2 (2017-02-07)
- **[Fix]** Fix Typedoc generation: use `tsconfig.json` generated for the lib.
- **[Fix]** Write source map for `.mjs` files
- **[Fix]** Copy sources to `_src` when publishing a lib (#87).
- **[Internal]** Restore continuous deployment of documentation.
## 0.16.1 (2017-01-20)
- **[Feature]** Support `mocha` tests on `.mjs` files (using `@std/esm`). Enabled by default
if `outModules` is configured to emit `.mjs`. **You currently need to add
`"@std/esm": {"esm": "cjs"}` to your `package.json`.**
## 0.16.0 (2017-01-09)
- **[Breaking change]** Enable `allowSyntheticDefaultImports` and `esModuleInterop` by default
- **[Fix]** Allow deep module imports in default Tslint rules
- **[Fix]** Drop dependency on deprecated `gulp-util`
- **[Internal]** Replace most custom typings by types from `@types`
## 0.15.8 (2017-12-05)
- **[Fix]** Exit with non-zero code if command tested with coverage fails
- **[Fix]** Solve duplicated error message when using the `run` mocha task.
- **[Fix]** Exit with non-zero code when building scripts fails.
## 0.15.7 (2017-11-29)
- **[Feature]** Add `coverage` task to `mocha` target, use it for the default task
## 0.15.6 (2017-11-29)
- **[Fix]** Fix path to source in source maps.
- **[Fix]** Disable `number-literal-format` in default Tslint rules. It enforced uppercase for hex.
- **[Internal]** Enable integration with Greenkeeper.
- **[Internal]** Enable integration with Codecov
- **[Internal]** Enable code coverage
## 0.15.5 (2017-11-10)
- **[Feature]** Enable the following TsLint rules: `no-duplicate-switch-case`, `no-implicit-dependencies`,
`no-return-await`
- **[Internal]** Update self-dependency `0.15.4`, this restores the README on _npm_
- **[Internal]** Add homepage and author fields to package.json
## 0.15.4 (2017-11-10)
- **[Fix]** Add support for custom additional copy for distribution builds. [#49](https://github.com/demurgos/turbo-gulp/issues/49)
- **[Internal]** Update self-dependency to `turbo-gulp`
- **[Internal]** Add link to license in `README.md`
## 0.15.3 (2017-11-09)
**Rename to `turbo-gulp`**. This package was previously named `demurgos-web-build-tools`.
This version is fully compatible: you can just change the name of your dependency.
## 0.15.2 (2017-11-09)
**The package is prepared to be renamed `turbo-gulp`.**
This is the last version released as `demurgos-web-build-tools`.
- **[Feature]** Add support for watch mode for library targets.
- **[Fix]** Disable experimental support for `*.mjs` by default.
- **[Fix]** Do not emit duplicate TS errors
## 0.15.1 (2017-10-19)
- **[Feature]** Add experimental support for `*.mjs` files
- **[Fix]** Fix support of releases from Continuous Deployment using Travis.
## 0.15.0 (2017-10-18)
- **[Fix]** Add error handling for git deployment.
- **[Internal]** Enable continuous deployment of the `master` branch.
## 0.15.0-beta.11 (2017-08-29)
- **[Feature]** Add `LibTarget.dist.copySrc` option to disable copy of source files to the dist directory.
This allows to prevent issues with missing custom typings.
- **[Fix]** Mark `deploy` property of `LibTarget.typedoc` as optional.
- **[Internal]** Update self-dependency to `v0.15.0-beta.10`.
## 0.15.0-beta.10 (2017-08-28)
- **[Breaking]** Update Tslint rules to use `tslint@5.7.0`.
- **[Fix]** Set `allowJs` to false in default TSC options.
- **[Fix]** Do not pipe output of git commands to stdout.
- **[Internal]** Update self-dependency to `v0.15.0-beta.9`.
## 0.15.0-beta.9 (2017-08-28)
- **[Breaking]** Drop old-style `test` target.
- **[Breaking]** Drop old-style `node` target.
- **[Feature]** Add `mocha` target to run tests in `spec.ts` files.
- **[Feature]** Add `node` target to build and run top-level Node applications.
- **[Feature]** Provide `generateNodeTasks`, `generateLibTasks` and `generateMochaTasks` functions.
They create the tasks but do not register them.
- **[Fix]** Run `clean` before `dist`, if defined.
- **[Fix]** Run `dist` before `publish`.
## 0.15.0-beta.8 (2017-08-26)
- **[Fix]** Remove auth token and registry options for `<lib>:dist:publish`. It is better served
by configuring the environment appropriately.
## 0.15.0-beta.7 (2017-08-26)
- **[Feature]** Add `clean` task to `lib` targets.
- **[Fix]** Ensure that `gitHead` is defined when publishing a package to npm.
## 0.15.0-beta.6 (2017-08-22)
- **[Feature]** Add support for Typedoc deployment to a remote git branch (such as `gh-pages`)
- **[Feature]** Add support for `copy` tasks in new library target.
- **[Fix]** Resolve absolute paths when compiling scripts with custom typings.
## 0.15.0-beta.5 (2017-08-14)
- **[Fix]** Fix package entry for the main module.
## 0.15.0-beta.4 (2017-08-14)
- **[Breaking]** Drop ES5 build exposed to browsers with the `browser` field in `package.json`.
- **[Feature]** Introduce first new-style target (`LibTarget`). it supports typedoc generation, dev builds and
simple distribution.
## 0.15.0-beta.3 (2017-08-11)
- **[Breaking]** Update default lib target to use target-specific `srcDir`.
- **[Feature]** Allow to complete `srcDir` in target.
- **[Feature]** Add experimental library distribution supporting deep requires.
## 0.15.0-beta.2 (2017-08-10)
- **[Fix]** Default to CommonJS for project tsconfig.json
- **[Fix]** Add Typescript configuration for default project.
- **[Internal]** Update self-dependency to `0.15.0-beta.1`.
## 0.15.0-beta.1 (2017-08-09)
- **[Feature]** Support typed TSLint rules.
- **[Internal]** Update gulpfile.ts to use build tools `0.15.0-beta.0`.
- **[Fix]** Fix regressions caused by `0.15.0-beta.0` (missing type definition).
## 0.15.0-beta.0 (2017-08-09)
- **[Breaking]** Expose option interfaces directly in the main module instead of the `config` namespace.
- **[Breaking]** Rename `DEFAULT_PROJECT_OPTIONS` to `DEFAULT_PROJECT`.
- **[Feature]** Emit project-wide `tsconfig.json`.
- **[Internal]** Convert gulpfile to Typescript, use `ts-node` to run it.
- **[Internal]** Update dependencies
## 0.14.3 (2017-07-16)
- **[Feature]** Add `:lint:fix` project task to fix some lint errors.
## 0.14.2 (2017-07-10)
- **[Internal]** Update dependencies: add `package-lock.json` and update `tslint`.
## 0.14.1 (2017-06-17)
- **[Internal]** Update dependencies.
- **[Internal]** Drop dependency on _Bluebird_.
- **[Internal]** Drop dependency on _typings_.
## 0.14.0 (2017-05-10)
- **[Breaking]** Enforce trailing commas by default for multiline objects
- **[Feature]** Allow bump from either `master` or a branch with the same name as the tag (exampel: `v1.2.3`)
- **[Feature]** Support TSLint 8, allow to extend the default rules
- **[Patch]** Allow mergeable namespaces
# 0.13.1
- **[Patch]** Allow namespaces in the default TS-Lint config
# 0.13.0
- **[Breaking]** Major overhaul of the angular target. The server build no longer depends on the client.
- **[Breaking]** Update to `gulp@4` (from `gulp@3`)
- **[Breaking]** Update to `tslint@7` (from `tslint@6`), add stricter default rules
- **[Breaking]** Update signature of targetGenerators and project tasks: it only uses
`ProjectOptions` and `Target` now, the additional options are embedded in those two objects.
- **[Breaking]** Remove `:install`, `:instal:npm` and `:install:typings`. Use the `prepare` script in
your `package.json` file instead.
- Add `:tslint.json` project task to generate configuration for `tslint`
- Add first class support for processing of `pug` and `sass` files, similar to `copy`
- Implement end-to-end tests
- Enable `emitDecoratorMetadata` in default typescript options.
- Allow configuration of `:lint` with the `tslintOptions` property of the project configuration.
- Add `<target>:watch` tasks for incremental builds.
# 0.12.3
- Support `templateUrl` and `styleUrls` in angular modules.
# 0.12.2
- Add `<target>:build:copy` task. It copies user-defined files.
# 0.12.1
- Fix `<target>:watch` task.
# 0.12.0
- **[Breaking]**: Change naming convention for tasks. The names primary part is
the target, then the action (`lib:build` instead of `build:lib`) to group
the tasks per target.
- **[Breaking]**: Use `typeRoots` instead of `definitions` in configuration to
specify Typescript definition files.
- Generate `tsconfig.json` file (mainly for editors)
- Implement the `test` target to run unit-tests with `mocha`.
# 0.11.2
- Target `angular`: Add `build:<target>:assets:sass` for `.scss` files (Sassy CSS)
# 0.11.1
- Rename project to `web-build-tools` (`demurgos-web-build-tools` on _npm_)
- Target `angular`: Add `build:<target>:assets`, `build:<target>:pug` and `build:<target>:static`.
- Update `gulp-typescript`: solve error message during compilation
- Targets `node` and `angular`: `build:<target>:scripts` now include in-lined source maps
- Target `node`: `watch:<target>` to support incremental builds

21
frontend/node_modules/@bcoe/v8-coverage/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright © 2015-2017 Charles Samborski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
frontend/node_modules/@bcoe/v8-coverage/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,14 @@
Copyright (c) 2017, Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

11
frontend/node_modules/@bcoe/v8-coverage/README.md generated vendored Normal file
View File

@@ -0,0 +1,11 @@
# V8 Coverage
[![npm](https://img.shields.io/npm/v/@c88/v8-coverage.svg?maxAge=2592000)](https://www.npmjs.com/package/@c88/v8-coverage)
[![GitHub repository](https://img.shields.io/badge/Github-demurgos%2Fv8--coverage-blue.svg)](https://github.com/demurgos/v8-coverage)
[![Build status (Travis)](https://img.shields.io/travis/demurgos/v8-coverage/master.svg?maxAge=2592000)](https://travis-ci.org/demurgos/v8-coverage)
[![Build status (AppVeyor)](https://ci.appveyor.com/api/projects/status/qgcbdffyb9e09d0e?svg=true)](https://ci.appveyor.com/project/demurgos/v8-coverage)
[![Codecov](https://codecov.io/gh/demurgos/v8-coverage/branch/master/graph/badge.svg)](https://codecov.io/gh/demurgos/v8-coverage)
## License
[MIT License](./LICENSE.md)

95
frontend/node_modules/@bcoe/v8-coverage/gulpfile.ts generated vendored Normal file
View File

@@ -0,0 +1,95 @@
import * as buildTools from "turbo-gulp";
import { LibTarget, registerLibTasks } from "turbo-gulp/targets/lib";
import { MochaTarget, registerMochaTasks } from "turbo-gulp/targets/mocha";
import gulp from "gulp";
import minimist from "minimist";
interface Options {
devDist?: string;
}
const options: Options & minimist.ParsedArgs = minimist(process.argv.slice(2), {
string: ["devDist"],
default: {devDist: undefined},
alias: {devDist: "dev-dist"},
});
const project: buildTools.Project = {
root: __dirname,
packageJson: "package.json",
buildDir: "build",
distDir: "dist",
srcDir: "src",
typescript: {}
};
const lib: LibTarget = {
project,
name: "lib",
srcDir: "src/lib",
scripts: ["**/*.ts"],
mainModule: "index",
dist: {
packageJsonMap: (old: buildTools.PackageJson): buildTools.PackageJson => {
const version: string = options.devDist !== undefined ? `${old.version}-build.${options.devDist}` : old.version;
return <any> {...old, version, scripts: undefined, private: false};
},
npmPublish: {
tag: options.devDist !== undefined ? "next" : "latest",
},
},
tscOptions: {
declaration: true,
skipLibCheck: true,
},
typedoc: {
dir: "typedoc",
name: "Helpers for V8 coverage files",
deploy: {
repository: "git@github.com:demurgos/v8-coverage.git",
branch: "gh-pages",
},
},
copy: [
{
files: ["**/*.json"],
},
],
clean: {
dirs: ["build/lib", "dist/lib"],
},
};
const test: MochaTarget = {
project,
name: "test",
srcDir: "src",
scripts: ["test/**/*.ts", "lib/**/*.ts", "e2e/*/*.ts"],
customTypingsDir: "src/custom-typings",
tscOptions: {
allowSyntheticDefaultImports: true,
esModuleInterop: true,
skipLibCheck: true,
},
// generateTestMain: true,
copy: [
{
src: "e2e",
// <project-name>/(project|test-resources)/<any>
files: ["*/project/**/*", "*/test-resources/**/*"],
dest: "e2e",
},
],
clean: {
dirs: ["build/test"],
},
};
const libTasks: any = registerLibTasks(gulp, lib);
registerMochaTasks(gulp, test);
buildTools.projectTasks.registerAll(gulp, project);
gulp.task("all:tsconfig.json", gulp.parallel("lib:tsconfig.json", "test:tsconfig.json"));
gulp.task("dist", libTasks.dist);
gulp.task("default", libTasks.dist);

48
frontend/node_modules/@bcoe/v8-coverage/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "@bcoe/v8-coverage",
"version": "0.2.3",
"description": "Helper functions for V8 coverage files.",
"author": "Charles Samborski <demurgos@demurgos.net> (https://demurgos.net)",
"license": "MIT",
"main": "dist/lib/index",
"types": "dist/lib/index.d.ts",
"repository": {
"type": "git",
"url": "git://github.com/demurgos/v8-coverage.git"
},
"homepage": "https://demurgos.github.io/v8-coverage",
"scripts": {
"prepare": "gulp all:tsconfig.json && gulp dist",
"pretest": "gulp lib:build",
"test": "gulp test",
"lint": "gulp :lint:fix"
},
"devDependencies": {
"@types/chai": "^4.1.4",
"@types/gulp": "^4.0.5",
"@types/minimist": "^1.2.0",
"@types/mocha": "^5.2.2",
"@types/node": "^10.5.4",
"chai": "^4.1.2",
"codecov": "^3.0.2",
"gulp": "^4.0.0",
"gulp-cli": "^2.0.1",
"minimist": "^1.2.0",
"pre-commit": "^1.2.2",
"ts-node": "^8.3.0",
"turbo-gulp": "^0.20.1"
},
"nyc": {
"include": [
"build/test/lib/**/*.js",
"build/test/lib/**/*.mjs"
],
"reporter": [
"text",
"html"
],
"extension": [
".mjs"
]
}
}

View File

@@ -0,0 +1,280 @@
import chai from "chai";
import fs from "fs";
import path from "path";
import { FunctionCov, mergeFunctionCovs, mergeProcessCovs, mergeScriptCovs, ProcessCov, ScriptCov } from "../lib";
const REPO_ROOT: string = path.join(__dirname, "..", "..", "..", "..");
const BENCHES_INPUT_DIR: string = path.join(REPO_ROOT, "benches");
const BENCHES_DIR: string = path.join(REPO_ROOT, "test-data", "merge", "benches");
const RANGES_DIR: string = path.join(REPO_ROOT, "test-data", "merge", "ranges");
const BENCHES_TIMEOUT: number = 20000; // 20sec
interface MergeRangeItem {
name: string;
status: "run" | "skip" | "only";
inputs: ProcessCov[];
expected: ProcessCov;
}
const FIXTURES_DIR: string = path.join(REPO_ROOT, "test-data", "bugs");
function loadFixture(name: string) {
const content: string = fs.readFileSync(
path.resolve(FIXTURES_DIR, `${name}.json`),
{encoding: "UTF-8"},
);
return JSON.parse(content);
}
describe("merge", () => {
describe("Various", () => {
it("accepts empty arrays for `mergeProcessCovs`", () => {
const inputs: ProcessCov[] = [];
const expected: ProcessCov = {result: []};
const actual: ProcessCov = mergeProcessCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
it("accepts empty arrays for `mergeScriptCovs`", () => {
const inputs: ScriptCov[] = [];
const expected: ScriptCov | undefined = undefined;
const actual: ScriptCov | undefined = mergeScriptCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
it("accepts empty arrays for `mergeFunctionCovs`", () => {
const inputs: FunctionCov[] = [];
const expected: FunctionCov | undefined = undefined;
const actual: FunctionCov | undefined = mergeFunctionCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
it("accepts arrays with a single item for `mergeProcessCovs`", () => {
const inputs: ProcessCov[] = [
{
result: [
{
scriptId: "123",
url: "/lib.js",
functions: [
{
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 2, count: 1},
{startOffset: 2, endOffset: 3, count: 1},
],
},
],
},
],
},
];
const expected: ProcessCov = {
result: [
{
scriptId: "0",
url: "/lib.js",
functions: [
{
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 3, count: 1},
],
},
],
},
],
};
const actual: ProcessCov = mergeProcessCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
describe("mergeProcessCovs", () => {
// see: https://github.com/demurgos/v8-coverage/issues/2
it("handles function coverage merged into block coverage", () => {
const blockCoverage: ProcessCov = loadFixture("issue-2-block-coverage");
const functionCoverage: ProcessCov = loadFixture("issue-2-func-coverage");
const inputs: ProcessCov[] = [
functionCoverage,
blockCoverage,
];
const expected: ProcessCov = loadFixture("issue-2-expected");
const actual: ProcessCov = mergeProcessCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
// see: https://github.com/demurgos/v8-coverage/issues/2
it("handles block coverage merged into function coverage", () => {
const blockCoverage: ProcessCov = loadFixture("issue-2-block-coverage");
const functionCoverage: ProcessCov = loadFixture("issue-2-func-coverage");
const inputs: ProcessCov[] = [
blockCoverage,
functionCoverage,
];
const expected: ProcessCov = loadFixture("issue-2-expected");
const actual: ProcessCov = mergeProcessCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
});
it("accepts arrays with a single item for `mergeScriptCovs`", () => {
const inputs: ScriptCov[] = [
{
scriptId: "123",
url: "/lib.js",
functions: [
{
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 2, count: 1},
{startOffset: 2, endOffset: 3, count: 1},
],
},
],
},
];
const expected: ScriptCov | undefined = {
scriptId: "123",
url: "/lib.js",
functions: [
{
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 3, count: 1},
],
},
],
};
const actual: ScriptCov | undefined = mergeScriptCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
it("accepts arrays with a single item for `mergeFunctionCovs`", () => {
const inputs: FunctionCov[] = [
{
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 2, count: 1},
{startOffset: 2, endOffset: 3, count: 1},
],
},
];
const expected: FunctionCov = {
functionName: "test",
isBlockCoverage: true,
ranges: [
{startOffset: 0, endOffset: 4, count: 2},
{startOffset: 1, endOffset: 3, count: 1},
],
};
const actual: FunctionCov | undefined = mergeFunctionCovs(inputs);
chai.assert.deepEqual(actual, expected);
});
});
describe("ranges", () => {
for (const sourceFile of getSourceFiles()) {
const relPath: string = path.relative(RANGES_DIR, sourceFile);
describe(relPath, () => {
const content: string = fs.readFileSync(sourceFile, {encoding: "UTF-8"});
const items: MergeRangeItem[] = JSON.parse(content);
for (const item of items) {
const test: () => void = () => {
const actual: ProcessCov | undefined = mergeProcessCovs(item.inputs);
chai.assert.deepEqual(actual, item.expected);
};
switch (item.status) {
case "run":
it(item.name, test);
break;
case "only":
it.only(item.name, test);
break;
case "skip":
it.skip(item.name, test);
break;
default:
throw new Error(`Unexpected status: ${item.status}`);
}
}
});
}
});
describe("benches", () => {
for (const bench of getBenches()) {
const BENCHES_TO_SKIP: Set<string> = new Set();
if (process.env.CI === "true") {
// Skip very large benchmarks when running continuous integration
BENCHES_TO_SKIP.add("node@10.11.0");
BENCHES_TO_SKIP.add("npm@6.4.1");
}
const name: string = path.basename(bench);
if (BENCHES_TO_SKIP.has(name)) {
it.skip(`${name} (skipped: too large for CI)`, testBench);
} else {
it(name, testBench);
}
async function testBench(this: Mocha.Context) {
this.timeout(BENCHES_TIMEOUT);
const inputFileNames: string[] = await fs.promises.readdir(bench);
const inputPromises: Promise<ProcessCov>[] = [];
for (const inputFileName of inputFileNames) {
const resolved: string = path.join(bench, inputFileName);
inputPromises.push(fs.promises.readFile(resolved).then(buffer => JSON.parse(buffer.toString("UTF-8"))));
}
const inputs: ProcessCov[] = await Promise.all(inputPromises);
const expectedPath: string = path.join(BENCHES_DIR, `${name}.json`);
const expectedContent: string = await fs.promises.readFile(expectedPath, {encoding: "UTF-8"}) as string;
const expected: ProcessCov = JSON.parse(expectedContent);
const startTime: number = Date.now();
const actual: ProcessCov | undefined = mergeProcessCovs(inputs);
const endTime: number = Date.now();
console.error(`Time (${name}): ${(endTime - startTime) / 1000}`);
chai.assert.deepEqual(actual, expected);
console.error(`OK: ${name}`);
}
}
});
});
function getSourceFiles() {
return getSourcesFrom(RANGES_DIR);
function* getSourcesFrom(dir: string): Iterable<string> {
const names: string[] = fs.readdirSync(dir);
for (const name of names) {
const resolved: string = path.join(dir, name);
const stat: fs.Stats = fs.statSync(resolved);
if (stat.isDirectory()) {
yield* getSourcesFrom(dir);
} else {
yield resolved;
}
}
}
}
function* getBenches(): Iterable<string> {
const names: string[] = fs.readdirSync(BENCHES_INPUT_DIR);
for (const name of names) {
const resolved: string = path.join(BENCHES_INPUT_DIR, name);
const stat: fs.Stats = fs.statSync(resolved);
if (stat.isDirectory()) {
yield resolved;
}
}
}

59
frontend/node_modules/@bcoe/v8-coverage/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,59 @@
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"charset": "utf8",
"checkJs": false,
"declaration": false,
"disableSizeLimit": false,
"downlevelIteration": false,
"emitBOM": false,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": false,
"inlineSourceMap": false,
"inlineSources": false,
"isolatedModules": false,
"lib": [
"es2017",
"esnext.asynciterable"
],
"locale": "en-us",
"module": "commonjs",
"moduleResolution": "node",
"newLine": "lf",
"noEmit": false,
"noEmitHelpers": false,
"noEmitOnError": true,
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noStrictGenericChecks": false,
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitUseStrict": false,
"noLib": false,
"noResolve": false,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"target": "es2017",
"traceResolution": false,
"typeRoots": [
"src/lib/custom-typings",
"node_modules/@types"
]
}
}