Don't run dev mode tests on windows (#2262)

* Don't run dev mode tests on windows

* Debugging

* chore(lint): Prettier fix

* remove the throw

* Skip a different way

* chore(lint): Prettier fix

* Skip the error test on windows too

* chore(lint): Prettier fix

* Move the after into the closure

* chore(lint): Prettier fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Matthew Phillips 2021-12-23 15:24:02 -05:00 committed by GitHub
parent 160b45bf4d
commit 991c30a72a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 23 deletions

View file

@ -1,21 +1,27 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let fixture;
let devServer;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/errors',
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-solid', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
vite: {
optimizeDeps: false, // necessary to prevent Vite throwing on bad files
},
});
devServer = await fixture.startDevServer();
});
import { isWindows, loadFixture } from './test-utils.js';
describe('Error display', () => {
if (isWindows) return;
let fixture;
let devServer;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/errors',
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-solid', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
vite: {
optimizeDeps: false, // necessary to prevent Vite throwing on bad files
},
});
devServer = await fixture.startDevServer();
});
after(async () => {
await devServer.stop();
});
describe('Astro', () => {
it('syntax error in template', async () => {
const res = await fixture.fetch('/astro-syntax-error');
@ -200,7 +206,3 @@ describe('Error display', () => {
});
});
});
after(async () => {
await devServer.stop();
});

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { isWindows, loadFixture } from './test-utils.js';
let fixture;
@ -75,6 +75,8 @@ describe('React Components', () => {
});
});
if (isWindows) return;
describe('dev', () => {
let devServer;

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { isWindows, loadFixture } from './test-utils.js';
describe('Solid component', () => {
let fixture;
@ -29,6 +29,8 @@ describe('Solid component', () => {
});
});
if (isWindows) return;
describe('dev', () => {
let devServer;

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { isWindows, loadFixture } from './test-utils.js';
describe('Svelte component', () => {
let fixture;
@ -28,6 +28,8 @@ describe('Svelte component', () => {
});
});
if (isWindows) return;
describe('dev', () => {
let devServer;

View file

@ -6,6 +6,7 @@ import { loadConfig } from '../dist/core/config.js';
import dev from '../dist/core/dev/index.js';
import build from '../dist/core/build/index.js';
import preview from '../dist/core/preview/index.js';
import os from 'os';
/**
* @typedef {import('node-fetch').Response} Response
* @typedef {import('../src/core/dev/index').DevServer} DevServer
@ -109,3 +110,5 @@ export function cli(/** @type {string[]} */ ...args) {
return spawned;
}
export const isWindows = os.platform() === 'win32';

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import { isWindows, loadFixture } from './test-utils.js';
describe('Vue component', () => {
let fixture;
@ -43,6 +43,8 @@ describe('Vue component', () => {
});
});
if (isWindows) return;
describe('dev', () => {
let devServer;