-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add GH action workflow * chore: fix tests * chore: add pnpm in GH actions * chore: fix workflow * chore: fix tests on windows * chore: test npmrc existance
- Loading branch information
1 parent
c03a580
commit 8d63641
Showing
4 changed files
with
47 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
node-version: ["20.x"] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- run: npm i | ||
- run: npm run build --if-present | ||
- run: npm test |
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,12 +1,13 @@ | ||
import * as path from "path"; | ||
import * as fs from "fs"; | ||
import { isDirectory, isFile, runJsr, withTempEnv } from "./test_utils"; | ||
import * as assert from "node:assert/strict"; | ||
|
||
describe("install", () => { | ||
it("jsr i @std/encoding - resolve latest version", async () => { | ||
await withTempEnv(["i", "@std/encoding"], async (getPkgJson, dir) => { | ||
const pkgJson = await getPkgJson(); | ||
assert( | ||
assert.ok( | ||
pkgJson.dependencies && "@std/encoding" in pkgJson.dependencies, | ||
"Missing dependency entry" | ||
); | ||
|
@@ -17,7 +18,14 @@ describe("install", () => { | |
); | ||
|
||
const depPath = path.join(dir, "node_modules", "@std", "encoding"); | ||
assert(await isDirectory(depPath), "Not installed in node_modules"); | ||
assert.ok(await isDirectory(depPath), "Not installed in node_modules"); | ||
|
||
const npmrcPath = path.join(dir, ".npmrc"); | ||
const npmRc = await fs.promises.readFile(npmrcPath, "utf-8"); | ||
assert.ok( | ||
npmRc.includes("@jsr:registry=https://npm.jsr.io"), | ||
"Missing npmrc registry" | ||
); | ||
}); | ||
}); | ||
|
||
|
@@ -96,7 +104,7 @@ describe("install", () => { | |
await withTempEnv( | ||
["i", "--npm", "@std/[email protected]"], | ||
async (_, dir) => { | ||
assert( | ||
assert.ok( | ||
await isFile(path.join(dir, "package-lock.json")), | ||
"npm lockfile not created" | ||
); | ||
|
@@ -108,7 +116,7 @@ describe("install", () => { | |
await withTempEnv( | ||
["i", "--yarn", "@std/[email protected]"], | ||
async (_, dir) => { | ||
assert( | ||
assert.ok( | ||
await isFile(path.join(dir, "yarn.lock")), | ||
"yarn lockfile not created" | ||
); | ||
|
@@ -120,7 +128,7 @@ describe("install", () => { | |
await withTempEnv( | ||
["i", "--pnpm", "@std/[email protected]"], | ||
async (_, dir) => { | ||
assert( | ||
assert.ok( | ||
await isFile(path.join(dir, "pnpm-lock.yaml")), | ||
"pnpm lockfile not created" | ||
); | ||
|
@@ -140,7 +148,7 @@ describe("remove", () => { | |
assert.equal(pkgJson.dependencies, undefined); | ||
|
||
const depPath = path.join(dir, "node_modules", "@std", "encoding"); | ||
assert( | ||
assert.ok( | ||
!(await isDirectory(depPath)), | ||
"Folder in node_modules not removed" | ||
); | ||
|
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