chore: create internal package for mocha-runner (#10985)

This commit is contained in:
jrandolf 2023-09-22 01:58:14 -07:00 committed by GitHub
parent d124c83dad
commit 07fe42fce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 21 deletions

14
package-lock.json generated
View File

@ -11,7 +11,8 @@
"test", "test",
"test/installation", "test/installation",
"tools/eslint", "tools/eslint",
"tools/doctest" "tools/doctest",
"tools/mocha-runner"
], ],
"devDependencies": { "devDependencies": {
"@actions/core": "1.10.1", "@actions/core": "1.10.1",
@ -1188,6 +1189,10 @@
"resolved": "tools/eslint", "resolved": "tools/eslint",
"link": true "link": true
}, },
"node_modules/@puppeteer/mocha-runner": {
"resolved": "tools/mocha-runner",
"link": true
},
"node_modules/@puppeteer/ng-schematics": { "node_modules/@puppeteer/ng-schematics": {
"resolved": "packages/ng-schematics", "resolved": "packages/ng-schematics",
"link": true "link": true
@ -11008,6 +11013,13 @@
"name": "@puppeteer/eslint", "name": "@puppeteer/eslint",
"version": "0.1.0", "version": "0.1.0",
"license": "Apache-2.0" "license": "Apache-2.0"
},
"tools/mocha-runner": {
"version": "0.1.0",
"license": "Apache-2.0",
"bin": {
"mocha-runner": "bin/mocha-runner.js"
}
} }
} }
} }

View File

@ -110,9 +110,10 @@
] ]
}, },
"test": { "test": {
"command": "cross-env PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT=20000 node tools/mocha-runner/lib/main.js --min-tests 1003", "command": "cross-env PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT=20000 npx ./tools/mocha-runner --min-tests 1003",
"dependencies": [ "dependencies": [
"./test:build" "./test:build",
"./tools/mocha-runner:build"
] ]
} }
}, },
@ -195,6 +196,7 @@
"test", "test",
"test/installation", "test/installation",
"tools/eslint", "tools/eslint",
"tools/doctest" "tools/doctest",
"tools/mocha-runner"
] ]
} }

View File

@ -15,7 +15,6 @@
"../packages/testserver:build" "../packages/testserver:build"
], ],
"files": [ "files": [
"../tools/mocha-runner/**",
"src/**" "src/**"
], ],
"output": [ "output": [

View File

@ -6,6 +6,5 @@
"outDir": "build", "outDir": "build",
"rootDir": "src" "rootDir": "src"
}, },
"include": ["src"], "include": ["src"]
"references": [{"path": "../tools/mocha-runner/tsconfig.json"}]
} }

View File

@ -6,7 +6,7 @@ It uses `/test/TestSuites.json` and `/test/TestExpectations.json` files to run m
## Running tests for Mocha Runner itself. ## Running tests for Mocha Runner itself.
```bash ```bash
npm run build && npx c8 node tools/mocha-runner/lib/test.js npm test
``` ```
## Running tests using Mocha Runner ## Running tests using Mocha Runner

View File

@ -0,0 +1,33 @@
{
"name": "@puppeteer/mocha-runner",
"version": "0.1.0",
"type": "commonjs",
"private": true,
"bin": "./bin/mocha-runner.js",
"description": "Mocha runner for Puppeteer",
"license": "Apache-2.0",
"scripts": {
"build": "wireit",
"test": "wireit",
"clean": "../clean.js"
},
"wireit": {
"build": {
"command": "tsc -b && chmod +x ./bin/mocha-runner.js",
"clean": "if-file-deleted",
"files": [
"src/**"
],
"output": [
"bin/**",
"tsconfig.tsbuildinfo"
]
},
"test": {
"command": "c8 node ./bin/test.js",
"dependencies": [
"build"
]
}
}
}

View File

@ -1,3 +1,5 @@
#! /usr/bin/env -S node
/** /**
* Copyright 2022 Google Inc. All rights reserved. * Copyright 2022 Google Inc. All rights reserved.
* *
@ -21,23 +23,23 @@ import os from 'os';
import path from 'path'; import path from 'path';
import { import {
type TestExpectation,
type MochaResults,
zTestSuiteFile,
zPlatform, zPlatform,
zTestSuiteFile,
type MochaResults,
type Platform,
type TestExpectation,
type TestSuite, type TestSuite,
type TestSuiteFile, type TestSuiteFile,
type Platform,
} from './types.js'; } from './types.js';
import { import {
extendProcessEnv, extendProcessEnv,
filterByPlatform,
readJSON,
filterByParameters, filterByParameters,
filterByPlatform,
getExpectationUpdates, getExpectationUpdates,
printSuggestions, printSuggestions,
type RecommendedExpectation, readJSON,
writeJSON, writeJSON,
type RecommendedExpectation,
} from './utils.js'; } from './utils.js';
function getApplicableTestSuites( function getApplicableTestSuites(

View File

@ -1,12 +1,13 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"allowJs": true, "rootDir": "./src",
"composite": true, "outDir": "./bin",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"outDir": "lib", "sourceMap": true,
"rootDir": "src" "declaration": false,
}, "declarationMap": false,
"include": ["src"] "composite": false
}
} }