Skip to content

Commit

Permalink
Fix test by note
Browse files Browse the repository at this point in the history
  • Loading branch information
mryhryki committed Aug 5, 2023
1 parent 11ed6fa commit 76f61f0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
npm pack
TARBALL="$(ls -1 mryhryki-simple-encryption-*.tgz | head -n 1)"
npm install "./${TARBALL}"
./node_modules/.bin/esbuild --bundle --platform=node --outfile=./dist/test.js ./src/test/index_node_with_packed_tarball.ts
cat ./dist/test.js | node --input-type=commonjs
deno task build:test
node src/test/index_node.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist/
node_modules/
package-lock.json
deno.lock
src/test/index.js
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.gitignore
.idea/
.vscode/
deno.*
docs/
package-lock.json
deno.*
script/
3 changes: 2 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"tasks": {
"build": "deno run --allow-env --allow-read --allow-write --allow-net ./src/script/bundle.ts",
"build": "deno run --allow-env --allow-read --allow-write --allow-net ./script/bundle.ts",
"build:test": "deno run --allow-env --allow-read --allow-write --allow-net ./script/bundle_test.ts",
"check": "deno check --all ./src/index.ts",
"format": "deno fmt --check ./src/",
"lint": "deno lint ./src/",
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
"crypto"
],
"scripts": {
"check": "deno check ./src/test/index.ts",
"fmt": "deno fmt ./src/",
"prepare": "deno task build",
"test": "deno test ./src/"
"prepare": "deno task build"
}
}
2 changes: 1 addition & 1 deletion src/script/bundle.ts → script/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { bundle } from "https://deno.land/x/emit/mod.ts";

const { code } = await bundle("./src/index.ts");
await Deno.mkdir("./dist/", { recursive: true });
await Deno.writeTextFile("./dist/bundle.js", code);
await Deno.writeTextFile("./dist/index.js", code);
5 changes: 5 additions & 0 deletions script/bundle_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { bundle } from "https://deno.land/x/emit/mod.ts";

const { code } = await bundle("./src/test/index.ts");
await Deno.mkdir("./dist/", { recursive: true });
await Deno.writeTextFile("./src/test/index.js", code);
6 changes: 6 additions & 0 deletions src/test/index_node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { webcrypto } from "node:crypto";
import { test } from "./index.js";
import { decrypt, encrypt } from "@mryhryki/simple-encryption";

globalThis.crypto = webcrypto;
test({ encrypt, decrypt });
6 changes: 0 additions & 6 deletions src/test/index_node.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/index_node_with_packed_tarball.ts

This file was deleted.

0 comments on commit 76f61f0

Please sign in to comment.