summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml8
-rw-r--r--packages/astro/src/runtime/server/endpoint.ts2
-rw-r--r--packages/astro/test/api-routes.test.js32
-rw-r--r--packages/astro/test/astro-envs.test.js1
-rw-r--r--packages/astro/test/dev-routing.test.js6
-rw-r--r--packages/astro/test/dynamic-endpoint-collision.js6
-rw-r--r--packages/astro/test/error-bad-js.test.js9
-rw-r--r--packages/astro/test/error-non-error.test.js6
-rw-r--r--packages/astro/test/fixtures/api-routes/src/pages/old-api/onearg/[param].json.js23
-rw-r--r--packages/astro/test/fixtures/api-routes/src/pages/old-api/twoarg/[param].json.js24
-rw-r--r--packages/astro/test/fixtures/component-library/package.json4
-rw-r--r--packages/astro/test/fixtures/slots-svelte/src/components/Counter.svelte3
-rw-r--r--packages/astro/test/fixtures/ssr-api-route/src/pages/food.json.js2
-rw-r--r--packages/astro/test/fixtures/static-build/src/pages/data/[slug].json.ts2
-rw-r--r--packages/astro/test/fixtures/with-endpoint-routes/src/pages/[slug].json.ts2
-rw-r--r--packages/astro/test/fixtures/with-endpoint-routes/src/pages/data/[slug].json.ts2
-rw-r--r--packages/astro/test/react-component.test.js6
-rw-r--r--packages/astro/test/root-srcdir-css.test.js1
-rw-r--r--packages/astro/test/test-utils.js6
-rw-r--r--packages/webapi/test/fetch.js6
-rw-r--r--pnpm-lock.yaml15
21 files changed, 62 insertions, 104 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6f7c2aa2a..f0e9af1fe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,6 +24,9 @@ env:
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true
ASTRO_TELEMETRY_DISABLED: true
+ # 7 GiB by default on GitHub, setting to 6 GiB
+ # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
+ NODE_OPTIONS: --max-old-space-size=6144
jobs:
lint:
@@ -112,11 +115,13 @@ jobs:
needs: build
strategy:
matrix:
- OS: [ubuntu-latest, windows-latest]
+ OS: [ubuntu-latest]
NODE_VERSION: [16, 18]
include:
- os: macos-latest
NODE_VERSION: 16
+ - os: windows-latest
+ NODE_VERSION: 16
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
@@ -221,4 +226,3 @@ jobs:
run: pnpm run test:smoke
env:
SKIP_OG: 1
- NODE_OPTIONS: "--max-old-space-size=4096"
diff --git a/packages/astro/src/runtime/server/endpoint.ts b/packages/astro/src/runtime/server/endpoint.ts
index a93d02adb..33ce8f6f9 100644
--- a/packages/astro/src/runtime/server/endpoint.ts
+++ b/packages/astro/src/runtime/server/endpoint.ts
@@ -40,6 +40,7 @@ ${chosenMethod} requests are not available when building a static site. Update y
return response;
}
+ // TODO: Remove support for old API in Astro 3.0
if (handler.length > 1) {
// eslint-disable-next-line no-console
console.warn(`
@@ -57,6 +58,7 @@ Update your code to remove this warning.`);
if (prop in target) {
return Reflect.get(target, prop);
} else if (prop in params) {
+ // TODO: Remove support for old API in Astro 3.0
// eslint-disable-next-line no-console
console.warn(`
API routes no longer pass params as the first argument. Instead an object containing a params property is provided in the form of:
diff --git a/packages/astro/test/api-routes.test.js b/packages/astro/test/api-routes.test.js
index 2536ad18f..278d2454e 100644
--- a/packages/astro/test/api-routes.test.js
+++ b/packages/astro/test/api-routes.test.js
@@ -10,38 +10,6 @@ describe('API routes', () => {
await fixture.build();
});
- describe('Deprecated API', () => {
- it('two argument supported', async () => {
- const one = JSON.parse(await fixture.readFile('/old-api/twoarg/one.json'));
- expect(one).to.deep.equal({
- param: 'one',
- pathname: '/old-api/twoarg/one.json',
- });
- const two = JSON.parse(await fixture.readFile('/old-api/twoarg/two.json'));
- expect(two).to.deep.equal({
- param: 'two',
- pathname: '/old-api/twoarg/two.json',
- });
- });
-
- it('param first argument is supported', async () => {
- const one = JSON.parse(await fixture.readFile('/old-api/onearg/one.json'));
- expect(one).to.deep.equal({
- param: 'one',
- });
- });
- });
-
- describe('1.0 API', () => {
- it('Receives a context argument', async () => {
- const one = JSON.parse(await fixture.readFile('/context/data/one.json'));
- expect(one).to.deep.equal({
- param: 'one',
- pathname: '/context/data/one.json',
- });
- });
- });
-
describe('Binary data', () => {
it('can be returned from a response', async () => {
const dat = await fixture.readFile('/binary.dat', null);
diff --git a/packages/astro/test/astro-envs.test.js b/packages/astro/test/astro-envs.test.js
index d2d06c28d..402878da5 100644
--- a/packages/astro/test/astro-envs.test.js
+++ b/packages/astro/test/astro-envs.test.js
@@ -53,7 +53,6 @@ describe('Environment Variables', () => {
it('includes public env in client-side JS', async () => {
let dirs = await fixture.readdir('/_astro');
- console.log(dirs);
let found = false;
// Look in all of the .js files to see if the public env is inlined.
diff --git a/packages/astro/test/dev-routing.test.js b/packages/astro/test/dev-routing.test.js
index c0f87375a..be3186493 100644
--- a/packages/astro/test/dev-routing.test.js
+++ b/packages/astro/test/dev-routing.test.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import { loadFixture } from './test-utils.js';
+import { loadFixture, silentLogging } from './test-utils.js';
describe('Development Routing', () => {
describe('No site config', () => {
@@ -10,7 +10,9 @@ describe('Development Routing', () => {
before(async () => {
fixture = await loadFixture({ root: './fixtures/without-site-config/' });
- devServer = await fixture.startDevServer();
+ devServer = await fixture.startDevServer({
+ logging: silentLogging,
+ });
});
after(async () => {
diff --git a/packages/astro/test/dynamic-endpoint-collision.js b/packages/astro/test/dynamic-endpoint-collision.js
index b8620568a..e1f4b2f03 100644
--- a/packages/astro/test/dynamic-endpoint-collision.js
+++ b/packages/astro/test/dynamic-endpoint-collision.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio';
-import { loadFixture } from './test-utils.js';
+import { loadFixture, silentLogging } from './test-utils.js';
describe('Dynamic endpoint collision', () => {
describe('build', () => {
@@ -31,7 +31,9 @@ describe('Dynamic endpoint collision', () => {
root: './fixtures/dynamic-endpoint-collision/',
});
- devServer = await fixture.startDevServer();
+ devServer = await fixture.startDevServer({
+ logging: silentLogging,
+ });
});
after(async () => {
diff --git a/packages/astro/test/error-bad-js.test.js b/packages/astro/test/error-bad-js.test.js
index 4315add2c..9149d8ad5 100644
--- a/packages/astro/test/error-bad-js.test.js
+++ b/packages/astro/test/error-bad-js.test.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as cheerio from 'cheerio';
-import { loadFixture } from './test-utils.js';
+import { loadFixture, silentLogging } from './test-utils.js';
describe('Errors in JavaScript', () => {
/** @type {import('./test-utils').Fixture} */
@@ -12,8 +12,13 @@ describe('Errors in JavaScript', () => {
before(async () => {
fixture = await loadFixture({
root: './fixtures/error-bad-js',
+ vite: {
+ logLevel: 'silent',
+ },
+ });
+ devServer = await fixture.startDevServer({
+ logging: silentLogging,
});
- devServer = await fixture.startDevServer();
});
after(async () => {
diff --git a/packages/astro/test/error-non-error.test.js b/packages/astro/test/error-non-error.test.js
index facf99633..0acdeb53e 100644
--- a/packages/astro/test/error-non-error.test.js
+++ b/packages/astro/test/error-non-error.test.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import { loadFixture } from './test-utils.js';
+import { loadFixture, silentLogging } from './test-utils.js';
describe('Can handle errors that are not instanceof Error', () => {
/** @type {import('./test-utils').Fixture} */
@@ -12,7 +12,9 @@ describe('Can handle errors that are not instanceof Error', () => {
fixture = await loadFixture({
root: './fixtures/error-non-error',
});
- devServer = await fixture.startDevServer();
+ devServer = await fixture.startDevServer({
+ logging: silentLogging
+ });
});
after(async () => {
diff --git a/packages/astro/test/fixtures/api-routes/src/pages/old-api/onearg/[param].json.js b/packages/astro/test/fixtures/api-routes/src/pages/old-api/onearg/[param].json.js
deleted file mode 100644
index 63771f8e0..000000000
--- a/packages/astro/test/fixtures/api-routes/src/pages/old-api/onearg/[param].json.js
+++ /dev/null
@@ -1,23 +0,0 @@
-
-export function getStaticPaths() {
- return [
- {
- params: {
- param: 'one'
- }
- },
- {
- params: {
- param: 'two'
- }
- },
- ]
-}
-
-export function get(params) {
- return {
- body: JSON.stringify({
- param: params.param
- })
- };
-}
diff --git a/packages/astro/test/fixtures/api-routes/src/pages/old-api/twoarg/[param].json.js b/packages/astro/test/fixtures/api-routes/src/pages/old-api/twoarg/[param].json.js
deleted file mode 100644
index ab71d6896..000000000
--- a/packages/astro/test/fixtures/api-routes/src/pages/old-api/twoarg/[param].json.js
+++ /dev/null
@@ -1,24 +0,0 @@
-
-export function getStaticPaths() {
- return [
- {
- params: {
- param: 'one'
- }
- },
- {
- params: {
- param: 'two'
- }
- },
- ]
-}
-
-export function get(params, request) {
- return {
- body: JSON.stringify({
- param: params.param,
- pathname: new URL(request.url).pathname
- })
- };
-}
diff --git a/packages/astro/test/fixtures/component-library/package.json b/packages/astro/test/fixtures/component-library/package.json
index 23c861101..0a677ced2 100644
--- a/packages/astro/test/fixtures/component-library/package.json
+++ b/packages/astro/test/fixtures/component-library/package.json
@@ -8,7 +8,9 @@
"@astrojs/svelte": "workspace:*",
"@test/component-library-shared": "workspace:*",
"astro": "workspace:*",
+ "preact": "^10.13.2",
"react": "^18.1.0",
- "react-dom": "^18.1.0"
+ "react-dom": "^18.1.0",
+ "svelte": "^3.58.0"
}
}
diff --git a/packages/astro/test/fixtures/slots-svelte/src/components/Counter.svelte b/packages/astro/test/fixtures/slots-svelte/src/components/Counter.svelte
index 24f4e734e..b03e016b7 100644
--- a/packages/astro/test/fixtures/slots-svelte/src/components/Counter.svelte
+++ b/packages/astro/test/fixtures/slots-svelte/src/components/Counter.svelte
@@ -28,7 +28,4 @@
margin-top: 2em;
place-items: center;
}
- .message {
- text-align: center;
- }
</style>
diff --git a/packages/astro/test/fixtures/ssr-api-route/src/pages/food.json.js b/packages/astro/test/fixtures/ssr-api-route/src/pages/food.json.js
index fecf83051..1f9ea5f29 100644
--- a/packages/astro/test/fixtures/ssr-api-route/src/pages/food.json.js
+++ b/packages/astro/test/fixtures/ssr-api-route/src/pages/food.json.js
@@ -9,7 +9,7 @@ export function get() {
};
}
-export async function post(params, request) {
+export async function post({ params, request }) {
const body = await request.text();
return new Response(body === `some data` ? `ok` : `not ok`, {
status: 200,
diff --git a/packages/astro/test/fixtures/static-build/src/pages/data/[slug].json.ts b/packages/astro/test/fixtures/static-build/src/pages/data/[slug].json.ts
index 51a12db2e..2bcfe50a1 100644
--- a/packages/astro/test/fixtures/static-build/src/pages/data/[slug].json.ts
+++ b/packages/astro/test/fixtures/static-build/src/pages/data/[slug].json.ts
@@ -5,7 +5,7 @@ export async function getStaticPaths() {
]
}
-export async function get(params) {
+export async function get({ params }) {
return {
body: JSON.stringify({
slug: params.slug,
diff --git a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/[slug].json.ts b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/[slug].json.ts
index b18660955..364c886e3 100644
--- a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/[slug].json.ts
+++ b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/[slug].json.ts
@@ -5,7 +5,7 @@ export async function getStaticPaths() {
];
}
-export async function get(params) {
+export async function get({ params }) {
return {
body: JSON.stringify({
slug: params.slug,
diff --git a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/data/[slug].json.ts b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/data/[slug].json.ts
index eea44d90b..4392c7ee7 100644
--- a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/data/[slug].json.ts
+++ b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/data/[slug].json.ts
@@ -5,7 +5,7 @@ export async function getStaticPaths() {
];
}
-export async function get(params) {
+export async function get({ params }) {
return {
body: JSON.stringify({
slug: params.slug,
diff --git a/packages/astro/test/react-component.test.js b/packages/astro/test/react-component.test.js
index 8c22cc861..7205b0342 100644
--- a/packages/astro/test/react-component.test.js
+++ b/packages/astro/test/react-component.test.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio';
-import { isWindows, loadFixture } from './test-utils.js';
+import { isWindows, loadFixture, silentLogging } from './test-utils.js';
let fixture;
@@ -103,7 +103,9 @@ describe('React Components', () => {
let devServer;
before(async () => {
- devServer = await fixture.startDevServer();
+ devServer = await fixture.startDevServer({
+ logging: silentLogging,
+ });
});
after(async () => {
diff --git a/packages/astro/test/root-srcdir-css.test.js b/packages/astro/test/root-srcdir-css.test.js
index 31fcc14d1..3902b4ab2 100644
--- a/packages/astro/test/root-srcdir-css.test.js
+++ b/packages/astro/test/root-srcdir-css.test.js
@@ -18,7 +18,6 @@ describe('srcDir', () => {
const relPath = $('link').attr('href');
const css = await fixture.readFile(relPath);
- console.log(css);
expect(css).to.match(/body{color:green}/);
});
});
diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js
index e6a9d648a..3acf8df48 100644
--- a/packages/astro/test/test-utils.js
+++ b/packages/astro/test/test-utils.js
@@ -68,6 +68,12 @@ export const defaultLogging = {
level: 'error',
};
+/** @type {import('../src/core/logger/core').LogOptions} */
+export const silentLogging = {
+ dest: nodeLogDestination,
+ level: 'silent',
+};
+
/**
* Load Astro fixture
* @param {AstroConfig} inlineConfig Astro config partial (note: must specify `root`)
diff --git a/packages/webapi/test/fetch.js b/packages/webapi/test/fetch.js
index 49aab31dc..ce0a2e700 100644
--- a/packages/webapi/test/fetch.js
+++ b/packages/webapi/test/fetch.js
@@ -13,13 +13,13 @@ describe('Fetch', () => {
it('Fetch with https', async () => {
const { fetch } = target
- const response = await fetch('https://api.openbrewerydb.org/breweries')
+ const response = await fetch('https://astro.build')
expect(response.constructor).to.equal(target.Response)
- const json = await response.json()
+ const html = await response.text()
- expect(json).to.be.an('array')
+ expect(html).to.include('<html')
})
it('Fetch with data', async () => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b9e26faca..891c4bc4b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2242,12 +2242,18 @@ importers:
astro:
specifier: workspace:*
version: link:../../..
+ preact:
+ specifier: ^10.13.2
+ version: 10.13.2
react:
specifier: ^18.1.0
version: 18.2.0
react-dom:
specifier: ^18.1.0
version: 18.2.0(react@18.2.0)
+ svelte:
+ specifier: ^3.58.0
+ version: 3.58.0
packages/astro/test/fixtures/component-library-shared:
dependencies:
@@ -15102,6 +15108,10 @@ packages:
/preact@10.11.0:
resolution: {integrity: sha512-Fk6+vB2kb6mSJfDgODq0YDhMfl0HNtK5+Uc9QqECO4nlyPAQwCI+BKyWO//idA7ikV7o+0Fm6LQmNuQi1wXI1w==}
+ /preact@10.13.2:
+ resolution: {integrity: sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw==}
+ dev: false
+
/prebuild-install@7.1.1:
resolution: {integrity: sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==}
engines: {node: '>=10'}
@@ -16430,6 +16440,11 @@ packages:
resolution: {integrity: sha512-tdrgeJU0hob0ZWAMoKXkhcxXA7dpTg6lZGxUeko5YqvPdJBiyRspGsCwV27kIrbrqPP2WUoSV9ca0gnLlw8YzQ==}
engines: {node: '>= 8'}
+ /svelte@3.58.0:
+ resolution: {integrity: sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==}
+ engines: {node: '>= 8'}
+ dev: false
+
/svg-tags@1.0.0:
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
dev: false