-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web-api: basic module system integration tests, removing unused bits,…
… dependency updates (#1724)
- Loading branch information
Fil Maj
authored
Jan 16, 2024
1 parent
e29f6a1
commit 5fe33e5
Showing
18 changed files
with
109 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/web-api/test/integration/commonjs-project/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
const WebApi = require('../../../dist/index'); | ||
const client = new WebApi.WebClient('invalid-token'); | ||
const assert = require('assert'); | ||
client.auth.test().then((res) => { | ||
console.error('❌ Unexpected `auth.test` API success! Exiting CJS project integration test with non-zero exit code.'); | ||
process.exit(1); | ||
}).catch((e) => { | ||
assert(e.message.includes('invalid_auth'), '❌ Did not receive expected "invalid_auth" response from `auth.test` API, CJS project integration test failed.'); | ||
console.log('✅ CJS project integration test succeeded!'); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/web-api/test/integration/commonjs-project/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "commonjs-project", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
import { WebClient } from '../../../dist/index.js'; | ||
import assert from 'assert'; | ||
const client = new WebClient('invalid-token'); | ||
try { | ||
const res = await client.auth.test(); | ||
console.error('❌ Unexpected auth.test success! Exiting ESM project integration test with non-zero exit code.'); | ||
process.exit(1); | ||
} catch (e) { | ||
assert(e.message.includes('invalid_auth'), '❌ Did not receive expected "invalid_auth" response from `auth.test` API, ESM project integration test failed.'); | ||
console.log('✅ ESM project integration test succeeded!'); | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/web-api/test/integration/esm-project/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "esm-project", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.mjs", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,27 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
|
||
"strict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
|
||
"moduleResolution": "node", | ||
"baseUrl": ".", | ||
"paths": { | ||
"*": ["./types/*"] | ||
}, | ||
"esModuleInterop" : true, | ||
|
||
// Not using this setting because its only used to require the package.json file, and that would change the | ||
// structure of the files in the dist directory because package.json is not located inside src. It would be nice | ||
// to use import instead of require(), but its not worth the tradeoff of restructuring the build (for now). | ||
// "resolveJsonModule": true, | ||
"outDir": "dist", | ||
"sourceMap": true, | ||
}, | ||
"extends": "@tsconfig/recommended/tsconfig.json", | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"exclude": [ | ||
"src/**/*.spec.js", | ||
"src/**/*.js" | ||
], | ||
"jsdoc": { | ||
"out": "support/jsdoc", | ||
"access": "public" | ||
}, | ||
"exclude": [ | ||
"src/**/*.js" | ||
], | ||
"ts-node": { | ||
"esm": true | ||
} | ||
} |