Skip to content

Commit

Permalink
chore: create internal package for mocha-runner (#10985)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Sep 22, 2023
1 parent d124c83 commit 07fe42f
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 21 deletions.
14 changes: 13 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Expand Up @@ -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"
]
}
},
Expand Down Expand Up @@ -195,6 +196,7 @@
"test",
"test/installation",
"tools/eslint",
"tools/doctest"
"tools/doctest",
"tools/mocha-runner"
]
}
1 change: 0 additions & 1 deletion test/package.json
Expand Up @@ -15,7 +15,6 @@
"../packages/testserver:build"
],
"files": [
"../tools/mocha-runner/**",
"src/**"
],
"output": [
Expand Down
3 changes: 1 addition & 2 deletions test/tsconfig.json
Expand Up @@ -6,6 +6,5 @@
"outDir": "build",
"rootDir": "src"
},
"include": ["src"],
"references": [{"path": "../tools/mocha-runner/tsconfig.json"}]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion tools/mocha-runner/README.md
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions tools/mocha-runner/package.json
@@ -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"
]
}
}
}
@@ -1,3 +1,5 @@
#! /usr/bin/env -S node

/**
* Copyright 2022 Google Inc. All rights reserved.
*
Expand All @@ -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(
Expand Down
13 changes: 7 additions & 6 deletions tools/mocha-runner/tsconfig.json
@@ -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
}
}

0 comments on commit 07fe42f

Please sign in to comment.