Skip to content

Commit

Permalink
test: check plugin replace rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamensuli committed Dec 26, 2023
1 parent 52d5aa4 commit 8dc1d28
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-replace": "5.0.5",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.5",
"@types/asciify": "1.3.33",
Expand Down
7 changes: 7 additions & 0 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import copy from 'rollup-plugin-copy'
import replace from '@rollup/plugin-replace';
import glob from 'glob';
import path from 'node:path';
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -150,6 +151,12 @@ function createTstPlugins(
dynamicRequireTargets: []
}),
json(),
replace({
preventAssignment:true,
'navigator.userAgent': JSON.stringify('Mozilla/5.0 (compatible; Node.js)'),
'window.navigator.userAgent': JSON.stringify('Mozilla/5.0 (compatible; Node.js)'),
"document._defaultView.navigator.userAgent": JSON.stringify('Mozilla/5.0 (compatible; Node.js)')
}),
]
}

Expand Down
10 changes: 5 additions & 5 deletions src/tests/Service.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'mocha';
import assert from 'node:assert'
import Service from '../Service'
import mochaJsdom from 'mocha-jsdom';
//import mochaJsdom from 'mocha-jsdom';


declare global {
Expand All @@ -18,10 +18,10 @@ describe("NODEFONY Service", () => {

before(() => {
global.service = new Service("test");
mochaJsdom({
// Options jsdom
url: 'http://localhost',
});
// mochaJsdom({
// // Options jsdom
// url: 'http://localhost',
// });
});
it("register", (done) => {
assert(Service);
Expand Down

0 comments on commit 8dc1d28

Please sign in to comment.