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/installation",
"tools/eslint",
"tools/doctest"
"tools/doctest",
"tools/mocha-runner"
],
"devDependencies": {
"@actions/core": "1.10.1",
@ -1188,6 +1189,10 @@
"resolved": "tools/eslint",
"link": true
},
"node_modules/@puppeteer/mocha-runner": {
"resolved": "tools/mocha-runner",
"link": true
},
"node_modules/@puppeteer/ng-schematics": {
"resolved": "packages/ng-schematics",
"link": true
@ -11008,6 +11013,13 @@
"name": "@puppeteer/eslint",
"version": "0.1.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": {
"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": [
"./test:build"
"./test:build",
"./tools/mocha-runner:build"
]
}
},
@ -195,6 +196,7 @@
"test",
"test/installation",
"tools/eslint",
"tools/doctest"
"tools/doctest",
"tools/mocha-runner"
]
}

View File

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

View File

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

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.
```bash
npm run build && npx c8 node tools/mocha-runner/lib/test.js
npm test
```
## 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.
*
@ -21,23 +23,23 @@ import os from 'os';
import path from 'path';
import {
type TestExpectation,
type MochaResults,
zTestSuiteFile,
zPlatform,
zTestSuiteFile,
type MochaResults,
type Platform,
type TestExpectation,
type TestSuite,
type TestSuiteFile,
type Platform,
} from './types.js';
import {
extendProcessEnv,
filterByPlatform,
readJSON,
filterByParameters,
filterByPlatform,
getExpectationUpdates,
printSuggestions,
type RecommendedExpectation,
readJSON,
writeJSON,
type RecommendedExpectation,
} from './utils.js';
function getApplicableTestSuites(

View File

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