|
|
@ -1,6 +1,7 @@
|
|
|
|
import assert from 'assert';
|
|
|
|
import assert from 'assert';
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import { env, normalizeHtml, svelte } from '../helpers.js';
|
|
|
|
import { parse } from 'acorn';
|
|
|
|
|
|
|
|
import { addLineNumbers, env, normalizeHtml, svelte } from '../helpers.js';
|
|
|
|
|
|
|
|
|
|
|
|
function tryRequire(file) {
|
|
|
|
function tryRequire(file) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -22,6 +23,15 @@ function normalizeWarning(warning) {
|
|
|
|
return warning;
|
|
|
|
return warning;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function checkCodeIsValid(code) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
parse(code);
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
console.error(addLineNumbers(code));
|
|
|
|
|
|
|
|
throw new Error(err.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
describe('css', () => {
|
|
|
|
describe('css', () => {
|
|
|
|
fs.readdirSync('test/css/samples').forEach(dir => {
|
|
|
|
fs.readdirSync('test/css/samples').forEach(dir => {
|
|
|
|
if (dir[0] === '.') return;
|
|
|
|
if (dir[0] === '.') return;
|
|
|
@ -67,6 +77,10 @@ describe('css', () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check the code is valid
|
|
|
|
|
|
|
|
checkCodeIsValid(dom.code);
|
|
|
|
|
|
|
|
checkCodeIsValid(ssr.code);
|
|
|
|
|
|
|
|
|
|
|
|
assert.equal(dom.css, ssr.css);
|
|
|
|
assert.equal(dom.css, ssr.css);
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
assert.deepEqual(
|
|
|
|