include sourcemap tests (and skip a tricky one, for now)

pull/1866/head
Rich Harris 7 years ago
parent 1c81f85c11
commit 2123071dc7

@ -14,7 +14,7 @@ export default class Binding extends Node {
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
if (info.expression.type !== 'Identifier' && info.expression.node.type !== 'MemberExpression') {
if (info.expression.type !== 'Identifier' && info.expression.type !== 'MemberExpression') {
component.error(info, {
code: 'invalid-directive-value',
message: 'Can only bind to an identifier (e.g. `foo`) or a member expression (e.g. `foo.bar` or `foo[baz]`)'

@ -1,7 +1,7 @@
import * as assert from 'assert';
import { svelte } from '../helpers.js';
describe('preprocess', () => {
describe.only('preprocess', () => {
it('preprocesses entire component', () => {
const source = `
<h1>Hello __NAME__!</h1>

@ -5,18 +5,19 @@ import { loadConfig, svelte } from "../helpers.js";
import { SourceMapConsumer } from "source-map";
import { getLocator } from "locate-character";
describe("sourcemaps", () => {
describe.only("sourcemaps", () => {
fs.readdirSync("test/sourcemaps/samples").forEach(dir => {
if (dir[0] === ".") return;
// add .solo to a sample directory name to only run that test
const solo = /\.solo/.test(dir);
const skip = /\.skip/.test(dir);
if (solo && process.env.CI) {
throw new Error("Forgot to remove `solo: true` from test");
}
(solo ? it.only : it)(dir, () => {
(solo ? it.only : skip ? it.skip : it)(dir, () => {
const config = loadConfig(`./sourcemaps/samples/${dir}/_config.js`);
const filename = path.resolve(

@ -1,18 +1,18 @@
export function test({ assert, smc, locateInSource, locateInGenerated }) {
const expected = locateInSource( 'potato' );
const expected = locateInSource('potato');
let start;
start = locateInGenerated( 'potato' );
start = locateInGenerated( 'potato', start.character + 1 );
start = locateInGenerated( 'potato', start.character + 1 ); // we need the third instance of 'potato'
start = locateInGenerated('potato');
start = locateInGenerated('potato', start.character + 1);
start = locateInGenerated('potato', start.character + 1); // we need the third instance of 'potato'
const actual = smc.originalPositionFor({
line: start.line + 1,
column: start.column
});
assert.deepEqual( actual, {
assert.deepEqual(actual, {
source: 'input.html',
name: null,
line: expected.line + 1,

@ -1,31 +1,31 @@
export function test({ assert, smc, locateInSource, locateInGenerated }) {
const expected = locateInSource( 'bar.baz' );
const expected = locateInSource('bar.baz');
let start;
let actual;
start = locateInGenerated( 'bar.baz' );
start = locateInGenerated('bar.baz');
actual = smc.originalPositionFor({
line: start.line + 1,
column: start.column
});
assert.deepEqual( actual, {
assert.deepEqual(actual, {
source: 'input.html',
name: null,
line: expected.line + 1,
column: expected.column
});
start = locateInGenerated( 'bar.baz', start.character + 1 );
start = locateInGenerated('bar.baz', start.character + 1);
actual = smc.originalPositionFor({
line: start.line + 1,
column: start.column
});
assert.deepEqual( actual, {
assert.deepEqual(actual, {
source: 'input.html',
name: null,
line: expected.line + 1,

Loading…
Cancel
Save