aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks/qunit_fixture.js
blob: 138ca662ddb7929065c22f4e2c8abde11f53c118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use strict";

var fs = require( "fs" );

module.exports = function( grunt ) {
	grunt.registerTask( "qunit_fixture", function() {
		var dest = "./test/data/qunit-fixture.js";
		fs.writeFileSync(
			dest,
			"// Generated by build/tasks/qunit_fixture.js\n" +
			"QUnit.config.fixture = " +
			JSON.stringify(
				fs.readFileSync(
					"./test/data/qunit-fixture.html",
					"utf8"
				).toString().replace( /\r\n/g, "\n" )
			) +
			";\n"
		);
		grunt.log.ok( "Updated " + dest + "." );
	} );
};