Skip to content

Commit

Permalink
implement test
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Jun 7, 2023
1 parent 4a2ff7f commit 044f9d6
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
- name: Use Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.26.1
deno-version: v1.34.1

- name: Install dependencies
run: pnpm install
Expand Down
8 changes: 7 additions & 1 deletion packages/integrations/deno/test/basics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ Deno.test({
const h1 = doc!.querySelector('h1');
assertEquals(h1!.innerText, 'test');
});


await t.step('node compatibility', async () => {
const resp = await fetch(new URL('/nodecompat', app.url));
assertEquals(resp.status, 200);
await resp.text()
})

app.stop();
},
});
3 changes: 2 additions & 1 deletion packages/integrations/deno/test/fixtures/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@astrojs/react": "workspace:*",
"@astrojs/mdx": "workspace:*",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"react-dom": "^18.1.0",
"node-fetch": "3.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
import ReactComponent from '../components/React.jsx';
import fs from 'node:fs';
fs.readFile('xyz')
const envValue = import.meta.env.SOME_VARIABLE;
---
<html>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
// node-fetch is implemented using node built-in module 'streams'
import fetch from 'node-fetch'
// unprefixed node built-in module
import path from 'path'
// prefixed node built-in module
import os from 'node:os'
const response = await fetch('https://api.github.com/users/github')
const data = await response.json()
---
<body>
<a href={path.posix.basename('/public/myfile.html')}>Go to my file</a>
<details>
<summary>CPU Architecture</summary>
<code>{os.arch()}</code>
</details>
<p>Everything went fine.</p>
</body>
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 044f9d6

Please sign in to comment.