Skip to content

Commit e6e7ad3

Browse files
committed
Add a separate test-run to cover client backward compatibility
1 parent 9dc746f commit e6e7ad3

18 files changed

+2362
-29
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ jobs:
2323
node-version: ${{ matrix.node-version }}
2424
check-latest: true
2525
cache: 'npm'
26-
cache-dependency-path: 'package.json'
26+
cache-dependency-path: |
27+
package.json
28+
test/backward-compat-fixtures/package.json
2729
2830
- run: npm install
31+
- run: npm install --prefix test/backward-compat-fixtures
2932

3033
- run: npm run ci-tests
3134
env:

karma.conf.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212
config.set({
1313
frameworks: ['mocha', 'chai', 'webpack'],
1414
files: [
15-
'test/**/*.spec.ts',
15+
'test/{unit,integration}/**/*.spec.ts',
1616
// Required for wasm due to https://github.com/ryanclark/karma-webpack/issues/498. Results
1717
// in an annoying warning before the webpack build, but then it works fine.
1818
{ pattern: `${outputDir}/**/*`, included: false, served: true }
@@ -76,6 +76,11 @@ module.exports = function(config) {
7676
new webpack.ProvidePlugin({
7777
process: 'process/browser',
7878
Buffer: ['buffer', 'Buffer'],
79+
}),
80+
new webpack.DefinePlugin({
81+
'process.env.MOCKTTP_BACKWARD_COMPAT_TEST': JSON.stringify(
82+
process.env.MOCKTTP_BACKWARD_COMPAT_TEST || ''
83+
)
7984
})
8085
],
8186
output: {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@
6464
"build:src": "tsc && chmod +x ./dist/admin/admin-bin.js",
6565
"build:doc": "typedoc src/main.ts",
6666
"postbuild:doc": "touch ./typedoc/.nojekyll",
67-
"test": "npm run build && npm run test:node && npm run test:browser && npm run test:perf",
68-
"test:node": "NODE_EXTRA_CA_CERTS=./test/fixtures/test-ca.pem TS_NODE_FILES=true mocha -r ts-node/register 'test/**/*.spec.ts'",
67+
"test": "npm run build && npm run test:node && npm run test:browser && npm run test:browser:backward-compat && npm run test:perf",
68+
"test:node": "NODE_EXTRA_CA_CERTS=./test/fixtures/test-ca.pem TS_NODE_FILES=true mocha -r ts-node/register 'test/{unit,integration}/**/*.spec.ts'",
6969
"test:browser": "npm run with-admin -- karma start",
70+
"test:browser:backward-compat": "MOCKTTP_BACKWARD_COMPAT_TEST=true node test/backward-compat-fixtures/node_modules/mockttp/dist/admin/admin-bin.js -c 'npx karma start --single-run'",
7071
"test:browser:debug": "npm run with-admin -- karma start --single-run=false --browsers ChromeWithCert",
7172
"test:perf": "NODE_EXTRA_CA_CERTS=./test/fixtures/test-ca.pem TS_NODE_FILES=true mocha -r ts-node/register 'test/performance/*.perf.ts'",
7273
"admin": "TS_NODE_FILES=true ts-node -e 'require(\"./src/main\").getAdminServer({ debug: true }).start()'",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

0 commit comments

Comments
 (0)