-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JST-112: Drop imports using .js extensions and… #527
Merged
grisha87
merged 11 commits into
master
from
feature/JST-112/drop-js-extensions-from-inport
Aug 7, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f33a31d
JST-112: Drop imports using .js extensions, adjust rollup config to p…
grisha87 73b284b
JST-134 Added unit tests to websockets and spec file support
pgrzy-golem 4bc6167
JST-112: Separated Goth tests from integration tests which can be run…
grisha87 9acbed7
JST-112: Fix rollup config to make cypress tests work again
grisha87 05e0a53
JST-112: Fixing issues with unit tests and node 16
grisha87 9bea235
JST-112: Bump yagna version to 0.13.0-rc.10 to fix cypress
grisha87 918f7ed
JST-112: Addressing remaining self-review notes
grisha87 2588218
JST-112: Addressing remaining self-review notes
grisha87 9bc2b55
JST-112: Dropping replaced dependencies
grisha87 5487c7b
Merge branch 'master' into feature/JST-112/drop-js-extensions-from-in…
grisha87 c50fc29
JST-112: Fixed skip unit test
mgordel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 |
---|---|---|
|
@@ -29,4 +29,4 @@ package-lock.json | |
.vscode | ||
|
||
#Nuxt | ||
/examples/adv-web-example/.nuxt | ||
/examples/adv-web-example/.nuxt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"preset": "ts-jest", | ||
"testEnvironment": "node" | ||
} |
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 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,57 @@ | ||
import { nodeResolve } from "@rollup/plugin-node-resolve"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import json from "@rollup/plugin-json"; | ||
import alias from "@rollup/plugin-alias"; | ||
import terser from "@rollup/plugin-terser"; | ||
import typescript from "@rollup/plugin-typescript"; | ||
import nodePolyfills from "rollup-plugin-polyfill-node"; | ||
import pkg from "./package.json" assert { type: "json" }; | ||
import ignore from "rollup-plugin-ignore"; | ||
|
||
/** | ||
* Looking for plugins? | ||
* | ||
* Check: {@link https://github.com/rollup/awesome} | ||
*/ | ||
|
||
export default [ | ||
// Browser | ||
{ | ||
input: "yajsapi/index.ts", | ||
output: { | ||
inlineDynamicImports: true, | ||
file: pkg.browser, | ||
name: "yajsapi", | ||
sourcemap: true, | ||
format: "es", | ||
}, | ||
plugins: [ | ||
ignore(["tmp", "pino", "eventsource"]), | ||
alias({ | ||
entries: [ | ||
{ find: "stream", replacement: "stream-browserify" }, | ||
{ find: /RedisDatastore/, replacement: "tests/mock/utils/empty_default.js" }, | ||
{ find: /IORedisConnection/, replacement: "tests/mock/utils/empty_default.js" }, | ||
{ find: /RedisConnection/, replacement: "tests/mock/utils/empty_default.js" }, | ||
{ find: /src\/api\/provider-api$/, replacement: "." }, | ||
{ find: /\.\/gftp.js/, replacement: "tests/mock/utils/empty.js" }, | ||
], | ||
}), | ||
nodeResolve({ browser: true, preferBuiltins: true }), | ||
commonjs(), | ||
nodePolyfills(), | ||
json(), // Required because one our dependencies (bottleneck) loads its own 'version.json' | ||
typescript({ tsconfig: "./tsconfig.json" }), | ||
terser({ keep_classnames: true }), | ||
], | ||
}, | ||
// NodeJS | ||
{ | ||
input: "yajsapi/index.ts", | ||
output: [ | ||
{ file: pkg.main, format: "cjs", sourcemap: true }, | ||
{ file: pkg.module, format: "es", sourcemap: true }, | ||
], | ||
plugins: [typescript({ tsconfig: "./tsconfig.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
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,21 +1,15 @@ | ||
import { Goth } from "../goth/goth.js"; | ||
import { Goth } from "../goth/goth"; | ||
import { resolve } from "path"; | ||
import chai from "chai"; | ||
import chaiAsPromised from "chai-as-promised"; | ||
|
||
chai.use(chaiAsPromised); | ||
const gothConfig = resolve("../goth/assets/goth-config.yml"); | ||
const goth = new Goth(gothConfig); | ||
const timeoutPromise = (seconds: number) => | ||
new Promise((_resolve, reject) => { | ||
setTimeout(() => reject(new Error(`The timeout was reached and the racing promise has rejected after ${seconds} seconds`)), seconds * 1000); | ||
}); | ||
|
||
before(async function () { | ||
this.timeout(180000); | ||
await goth.start(); | ||
}); | ||
after(async function () { | ||
this.timeout(180000); | ||
await goth.end(); | ||
}); | ||
export default async function setUpGoth() { | ||
const gothConfig = resolve("../goth/assets/goth-config.yml"); | ||
globalThis.__GOTH = new Goth(gothConfig); | ||
|
||
beforeEach(function () { | ||
console.log(`\n\n\xa0\xa0Trying to test: \x1b[32mIt ${this.currentTest?.title} ...\n\n`); | ||
}); | ||
// Start Goth, but don't wait for an eternity | ||
return await Promise.race([globalThis.__GOTH.start(), timeoutPromise(60)]); | ||
} |
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,17 @@ | ||
/** | ||
* Helper which allows replacing the default logger implemented in jest with the standard one for the duration of the test | ||
* | ||
* It was needed because of the way Goth tests are implemented - producing a lot of output on the console during the test | ||
* which is considered as an issue when using jest. Once we change the way we store Goth related logs, then we'll be | ||
* able to remove this file. | ||
*/ | ||
|
||
const jestConsole = console; | ||
|
||
beforeAll(() => { | ||
global.console = require("console"); | ||
}); | ||
|
||
afterAll(() => { | ||
global.console = jestConsole; | ||
}); |
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,3 @@ | ||
export default async function tearDownGoth() { | ||
await globalThis.__GOTH.end(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeout is defined in
test/integration/jest.config.json
so probably not needed here..