update typescript and fix test cases

This commit is contained in:
Yanzhen Yu
2019-04-02 21:43:16 +08:00
parent aa5b2d38b1
commit 7b02f13a19
3 changed files with 11 additions and 4 deletions

View File

@@ -48,6 +48,6 @@
"ts-node": "^7.0.1",
"tslib": "^1.9.3",
"tslint": "^4.5.1",
"typescript": "^3.0.3"
"typescript": "^3.4.1"
}
}

View File

@@ -8,6 +8,7 @@ import * as rollup from 'rollup';
import typescript = require('rollup-plugin-typescript');
import { assert } from 'chai';
import { SnapshotState, toMatchSnapshot } from 'jest-snapshot';
import { Suite } from 'mocha';
const htmlFolder = path.join(__dirname, 'html');
const htmls = fs.readdirSync(htmlFolder).map(filePath => {
@@ -23,7 +24,7 @@ interface IMimeType {
}
const server = () =>
new Promise(resolve => {
new Promise<http.Server>(resolve => {
const mimeType: IMimeType = {
'.html': 'text/html',
'.js': 'text/javascript',
@@ -66,7 +67,13 @@ function matchSnapshot(actual: string, testFile: string, testTitle: string) {
return result;
}
describe('integration tests', () => {
interface ISuite extends Suite {
server: http.Server;
browser: puppeteer.Browser;
code: string;
}
describe('integration tests', function(this: ISuite) {
before(async () => {
this.server = await server();
this.browser = await puppeteer.launch({

View File

@@ -54,7 +54,7 @@ describe('absolute url to stylesheet', () => {
href,
),
).to.equal(
`background-image: url('http://localhost/css/images/b.jpg'); ` +
`background-image: url('http://localhost/css/images/b.jpg');` +
`background: #aabbcc url('http://localhost/css/images/a.jpg') 50% 50% repeat;`,
);
});