Skip to content

Commit 0843d40

Browse files
author
Andre Asselin
committed
Normalize line endings to LF for unit tests
1 parent 92d97a6 commit 0843d40

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"mkdirp": "^0.5.1",
6767
"mocha": "^2.2.5",
6868
"node-libs-browser": "^1.0.0",
69+
"normalize-newline": "^3.0.0",
6970
"postcss": "^5.0.21",
7071
"pug": "^2.0.0-beta6",
7172
"rimraf": "^2.4.0",

test/test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var genId = require('../lib/gen-id')
1010
var SourceMapConsumer = require('source-map').SourceMapConsumer
1111
var ExtractTextPlugin = require("extract-text-webpack-plugin")
1212
var compiler = require('../lib/template-compiler')
13+
var normalizeNewline = require('normalize-newline')
1314

1415
var loaderPath = 'expose?vueModule!' + path.resolve(__dirname, '../')
1516
var mfs = new MemoryFS()
@@ -103,6 +104,7 @@ describe('vue-loader', function () {
103104

104105
expect(module.data().msg).to.contain('Hello from Component A!')
105106
var style = window.document.querySelector('style').textContent
107+
style = normalizeNewline(style)
106108
expect(style).to.contain('comp-a h2 {\n color: #f00;\n}')
107109
done()
108110
})
@@ -161,6 +163,7 @@ describe('vue-loader', function () {
161163
expect(vnode.children[4][0].data.staticClass).to.equal('test')
162164

163165
var style = window.document.querySelector('style').textContent
166+
style = normalizeNewline(style)
164167
expect(style).to.contain('.test[' + id + '] {\n color: yellow;\n}')
165168
expect(style).to.contain('.test[' + id + ']:after {\n content: \'bye!\';\n}')
166169
expect(style).to.contain('h1[' + id + '] {\n color: green;\n}')
@@ -235,6 +238,7 @@ describe('vue-loader', function () {
235238
entry: './test/fixtures/media-query.vue'
236239
}, function (window) {
237240
var style = window.document.querySelector('style').textContent
241+
style = normalizeNewline(style)
238242
var id = 'data-v-' + genId(require.resolve('./fixtures/media-query.vue'))
239243
expect(style).to.contain('@media print {\n.foo[' + id + '] {\n color: #000;\n}\n}')
240244
done()
@@ -255,6 +259,7 @@ describe('vue-loader', function () {
255259
]
256260
}), function () {
257261
var css = mfs.readFileSync('/test.output.css').toString()
262+
css = normalizeNewline(css)
258263
expect(css).to.contain('h1 {\n color: #f00;\n}\n\nh2 {\n color: green;\n}')
259264
done()
260265
})
@@ -322,6 +327,7 @@ describe('vue-loader', function () {
322327
}
323328
}, function (window) {
324329
var style = window.document.querySelector('style').textContent
330+
style = normalizeNewline(style)
325331
expect(style).to.contain('h1 {\n color: red;\n font-size: 14px\n}')
326332
done()
327333
})
@@ -398,6 +404,7 @@ describe('vue-loader', function () {
398404
var style = [].slice.call(window.document.querySelectorAll('style')).map(function (style) {
399405
return style.textContent
400406
}).join('\n')
407+
style = normalizeNewline(style)
401408
expect(style).to.contain('.' + className + ' {\n color: red;\n}')
402409

403410
// animation name

0 commit comments

Comments
 (0)