fix(test-support): create cjs wrapper
MODIFY
packages/test-support/index.js
packages/test-support/index.js
-import { stubEnv } from './lib/env-utils';
-import { stubLog } from './lib/log-utils';
-import { fakeTime } from './lib/time-utils';
-import { withMocks, verifyMocks } from './lib/mock-utils';
-import { withSandbox, verifySandbox } from './lib/sandbox-utils';
-
-// this just needs to be imported, for the functionality to be injected
-import './lib/unhandled-rejection';
-
-export {
- stubEnv, stubLog, fakeTime, withSandbox, verifySandbox, withMocks, verifyMocks
-};
+module.exports = require('./build/lib');

ADD
packages/test-support/lib/index.js
+import { stubEnv } from './env-utils';
+import { stubLog } from './log-utils';
+import { fakeTime } from './time-utils';
+import { withMocks, verifyMocks } from './mock-utils';
+import { withSandbox, verifySandbox } from './sandbox-utils';
+
+// this just needs to be imported, for the functionality to be injected
+import './unhandled-rejection';
+
+export {
+ stubEnv, stubLog, fakeTime, withSandbox, verifySandbox, withMocks, verifyMocks
+};

MODIFY
packages/test-support/package.json
packages/test-support/package.json
},
"license": "Apache-2.0",
"author": "https://github.com/appium",
- "main": "./build/index.js",
"bin": {
"android-emu-travis-post": "./bin/android-emu-travis-post.sh",
"android-emu-travis-pre": "./bin/android-emu-travis-pre.sh"
"index.js",
"bin",
"lib",
- "build/index.js",
- "build/lib"
+ "build"
],
"dependencies": {
- "@appium/support": "^2.55.1",
+ "@appium/support": "file:../support",
"@babel/runtime": "7.16.3",
"bluebird": "3.7.2",
"lodash": "4.17.21",
"sinon": "12.0.1",
"source-map-support": "0.5.20"
},
- "devDependencies": {
- "@appium/eslint-config-appium": "^4.7.4",
- "@appium/gulp-plugins": "^5.5.5"
- },
"engines": {
"node": ">=12",
"npm": ">=6"

MODIFY
packages/test-support/test/env-utils-specs.js
packages/test-support/test/env-utils-specs.js
// transpile:mocha
-import { stubEnv } from '..';
+import { stubEnv } from '../lib';
const expect = chai.expect;

MODIFY
packages/test-support/test/log-utils-specs.js
packages/test-support/test/log-utils-specs.js
// transpile:mocha
-import { stubLog } from '..';
+import { stubLog } from '../lib';
import log from '../lib/logger';
import sinon from 'sinon';
import 'colors';

MODIFY
packages/test-support/test/sandbox-utils-specs.js
packages/test-support/test/sandbox-utils-specs.js
// transpile:mocha
-import { withSandbox, verifySandbox } from '..';
+import { withSandbox, verifySandbox } from '../lib';
const expect = chai.expect;

MODIFY
packages/test-support/test/time-utils-specs.js
packages/test-support/test/time-utils-specs.js
// transpile:mocha
-import { fakeTime } from '..';
+import { fakeTime } from '../lib';
import sinon from 'sinon';
import B from 'bluebird';

fix(test-support): create cjs wrapper