Skip to content

Commit 02f933f

Browse files
authored
CommonJS Support (#214)
- Removed external dependency for download - Use https to download and external module compressing to extract - Reworked tests
1 parent a781410 commit 02f933f

File tree

8 files changed

+526
-1087
lines changed

8 files changed

+526
-1087
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ build
6868
.idea/
6969
.DS_Store
7070
.vscode
71+
sc-loader

e2e/sc.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SauceLabs from '../build';
22

33
const ID = process.env.GITHUB_RUN_ID ?? '(local)';
44
// Only run the test when the env var is present
5-
// in GitHub Actions, otherwise it fails for untrusted PRs/
5+
// in GitHub Actions, otherwise it fails for untrusted PRs
66
const SKIP_TEST = process.env.GITHUB_RUN_ID && !process.env.SAUCE_USERNAME;
77

88
jest.setTimeout(60 * 1000); // 60s should be sufficient to boot SC
@@ -11,10 +11,11 @@ jest.setTimeout(60 * 1000); // 60s should be sufficient to boot SC
1111
* unmock
1212
*/
1313
jest
14-
.unmock('@xhmikosr/downloader')
14+
.unmock('https')
1515
.unmock('form-data')
1616
.unmock('got')
1717
.unmock('yargs')
18+
.unmock('compressing')
1819
.unmock('zlib');
1920

2021
test('should not be able to run Sauce Connect due to invalid credentials', async () => {

jest.config.js

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,16 @@
1-
const esModules = [
2-
// got and dependencies
3-
'got',
4-
'p-cancelable',
5-
'@szmarczak/http-timer',
6-
'lowercase-keys',
7-
'@sindresorhus/is',
8-
'cacheable-request',
9-
'normalize-url',
10-
'responselike',
11-
'cacheable-request',
12-
'mimic-response',
13-
'form-data-encoder',
14-
'cacheable-lookup',
15-
// @xhmikosr/downloader and dependencies
16-
'@xhmikosr/downloader',
17-
'@xhmikosr/archive-type',
18-
'file-type',
19-
'strtok3',
20-
'peek-readable',
21-
'token-types',
22-
'@xhmikosr/decompress',
23-
'@xhmikosr/decompress-tar',
24-
'is-stream',
25-
'filenamify',
26-
'trim-repeated',
27-
'escape-string-regexp',
28-
'filename-reserved-regex',
29-
'strip-outer',
30-
'p-event',
31-
'p-timeout',
32-
];
33-
341
module.exports = {
352
testMatch: ['<rootDir>/tests/**/*.test.js'],
363
testPathIgnorePatterns: ['/node_modules/'],
374
coverageDirectory: './coverage/',
385
collectCoverage: true,
396
coverageThreshold: {
407
global: {
41-
branches: 93,
42-
functions: 100,
43-
lines: 98,
44-
statements: 98,
8+
branches: 94,
9+
functions: 98,
10+
lines: 97,
11+
statements: 97,
4512
},
4613
},
4714
testEnvironment: 'node',
4815
restoreMocks: true,
49-
transformIgnorePatterns: esModules.length
50-
? [`/node_modules/(?!${esModules.join('|')})`]
51-
: [],
5216
};

0 commit comments

Comments
 (0)