]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: fix for mocha
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 17 Sep 2019 17:56:15 +0000 (19:56 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 17 Sep 2019 17:56:15 +0000 (19:56 +0200)
__tests__/helper.js
__tests__/ssr/basic.spec.js

index 1ba01ea92b8977e7a09523785b8827a20120b750..ccb6fb06dddf9abe8e8e6930e0109667f14efb92 100644 (file)
@@ -13,7 +13,10 @@ if (typeof global !== 'undefined' && typeof global.beforeAll === 'undefined') {
   // monkey patch jest snapshots
   expect.extend({
     toMatchInlineSnapshot(received, snapshot) {
-      const text = `[${received.toString()}]`
+      const text =
+        typeof received === 'string'
+          ? JSON.stringify(received)
+          : `[${received.toString()}]`
 
       const match = INITIAL_WS_RE.exec(snapshot)
       let expected = snapshot
index a553485c87115a6ddd0213e1b5ecb047c72140b4..0d678e1d2115b8c1a27e7917e78dd223a8d8c63b 100644 (file)
@@ -1,3 +1,6 @@
+// @ts-check
+require('../helper')
+const expect = require('expect')
 const { renderApp, renderer } = require('./shared')
 
 describe('SSR: basicRenderer', () => {