Skip to content

Enhancement/chai upgrade #1711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b0b9fd5
🔁: add babel module transform
merryman Dec 5, 2024
4ab23f9
🔁: add babel dependencies
merryman Dec 5, 2024
7011fc2
🔁: add babel tests and make tests formatting independent
merryman Dec 5, 2024
fe2b4d0
🔁: merge babel transform visitor for improved performance
merryman Dec 5, 2024
1f27290
🔁: silence dynamic import warning in babel
merryman Dec 18, 2024
d68b865
🔁: remove dead code and fix formatting in babel plugin
merryman Dec 20, 2024
a44082f
🔁: merge more visitors to improve performance
merryman Dec 20, 2024
4d38ae0
🔁: fix destructuring assignment transform bug
merryman Dec 19, 2024
de9b166
🧑‍🏫: add support for class transform to work with babel
merryman Dec 5, 2024
1b8b2d4
🧑‍🏫: add default acorn nodes to class transform, adjust tests
merryman Dec 5, 2024
fd5a01a
🧑‍🏫: adjust class transform in test
merryman Dec 14, 2024
1e37a40
❄️: bump rollup
merryman Dec 5, 2024
91f46db
❄️: fix bundling issue with babel modules
merryman Dec 5, 2024
b2fa874
❄️🧩🖥️: integrate babel transpiler
merryman Dec 5, 2024
8ab7523
🧩: fix storing source maps in local storage
merryman Dec 16, 2024
7ed31b5
🧩: fix module tests
merryman Dec 14, 2024
2a41efb
📦🧩🔁: switch to babel transpiler in server side
merryman Dec 18, 2024
6697b43
🎨❄️🧩: remove systemjs-init related stuff that is no longer needed
merryman Dec 18, 2024
30d361b
🧩🖥️: remove lively.transpiler references that are no longer needed
merryman Dec 18, 2024
2acf2a2
📙🖥️: fix some test issues
merryman Dec 16, 2024
68277ed
🧩: avoid issues with json files in freezer bundles
merryman Dec 5, 2024
f3306ed
📦: add format meta for packages-config
merryman Dec 11, 2024
b358817
☕️: bump chai and mocha
merryman Dec 5, 2024
7dbfd35
🌳🧑‍🏫🧩🎨📇: replace deep prop check with nested
merryman Dec 14, 2024
7a0eb78
🧩: use fuzzy parse to check for mocha test
merryman Dec 16, 2024
a64e09e
🎨: adjust spec comparison
merryman Dec 14, 2024
3fa270a
🎨: adjust render tests to work in non p3 envs
merryman Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions lively.ast/tests/es6-test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
/*global process, require, beforeEach, afterEach, describe, it*/
/* global process, require, beforeEach, afterEach, describe, it */

import { expect } from "mocha-es6";
import { expect } from 'mocha-es6';

import { parse } from "../lib/parser.js";
import { parse } from '../lib/parser.js';

describe('es6', function() {

it("arrow function", function() {
var code = '() => 23;'
var parsed = parse(code);
expect(parsed).deep.property("body[0].expression.type")
.equals("ArrowFunctionExpression");
describe('es6', function () {
it('arrow function', function () {
let code = '() => 23;';
let parsed = parse(code);
expect(parsed).has.nested.property('body[0].expression.type')
.equals('ArrowFunctionExpression');
});

});
69 changes: 32 additions & 37 deletions lively.ast/tests/parser-test.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
/*global beforeEach, afterEach, describe, it*/
/* global beforeEach, afterEach, describe, it */

import { expect } from "mocha-es6";
import { expect } from 'mocha-es6';

import { printAst } from "../lib/mozilla-ast-visitor-interface.js";
import { parse, parseFunction } from "../lib/parser.js";

describe('parse', function() {
import { printAst } from '../lib/mozilla-ast-visitor-interface.js';
import { parse, parseFunction } from '../lib/parser.js';

describe('parse', function () {
it('JavaScript code', () =>
expect(parse("1 + 2"))
.deep.property("body[0].type")
.equals("ExpressionStatement"));

describe("async / await", () => {

it("parses nested awaits", () => {
var src = "await (await foo()).bar()",
parsed = parse(src),
expected = ":Program(0-25)\n"
+ "\\-.body[0]:ExpressionStatement(0-25)\n"
+ " \\-.body[0].expression:AwaitExpression(0-25)\n"
+ " \\-.body[0].expression.argument:CallExpression(6-25)\n"
+ " \\-.body[0].expression.argument.callee:MemberExpression(6-23)\n"
+ " |-.body[0].expression.argument.callee.object:AwaitExpression(7-18)\n"
+ " | \\-.body[0].expression.argument.callee.object.argument:CallExpression(13-18)\n"
+ " | \\-.body[0].expression.argument.callee.object.argument.callee:Identifier(13-16)\n"
+ " \\-.body[0].expression.argument.callee.property:Identifier(20-23)"
expect(printAst(parsed, {printPositions: true})).to.equal(expected);
expect(parse('1 + 2'))
.nested.property('body[0].type')
.equals('ExpressionStatement'));

describe('async / await', () => {
it('parses nested awaits', () => {
let src = 'await (await foo()).bar()';
let parsed = parse(src);
let expected = ':Program(0-25)\n' +
'\\-.body[0]:ExpressionStatement(0-25)\n' +
' \\-.body[0].expression:AwaitExpression(0-25)\n' +
' \\-.body[0].expression.argument:CallExpression(6-25)\n' +
' \\-.body[0].expression.argument.callee:MemberExpression(6-23)\n' +
' |-.body[0].expression.argument.callee.object:AwaitExpression(7-18)\n' +
' | \\-.body[0].expression.argument.callee.object.argument:CallExpression(13-18)\n' +
' | \\-.body[0].expression.argument.callee.object.argument.callee:Identifier(13-16)\n' +
' \\-.body[0].expression.argument.callee.property:Identifier(20-23)';
expect(printAst(parsed, { printPositions: true })).to.equal(expected);
});

});

describe("parseFunction", () => {

it("anonmyous function", () => {
expect(parseFunction("function(x) { return x + 1; }").type).equals("FunctionExpression")
describe('parseFunction', () => {
it('anonmyous function', () => {
expect(parseFunction('function(x) { return x + 1; }').type).equals('FunctionExpression');
});

it("named function", () => {
expect(parseFunction("function foo(x) { return x + 1; }")).containSubset({type: "FunctionExpression", id: {name: "foo"}})
it('named function', () => {
expect(parseFunction('function foo(x) { return x + 1; }')).containSubset({ type: 'FunctionExpression', id: { name: 'foo' } });
});

it("arrow function", () => {
expect(parseFunction("(x) => { return x + 1; }")).containSubset({type: "ArrowFunctionExpression"})
it('arrow function', () => {
expect(parseFunction('(x) => { return x + 1; }')).containSubset({ type: 'ArrowFunctionExpression' });
});

it("short function", () => {
expect(parseFunction("x => x + 1")).containSubset({type: "ArrowFunctionExpression"})
it('short function', () => {
expect(parseFunction('x => x + 1')).containSubset({ type: 'ArrowFunctionExpression' });
});

});
});
Loading