spec: fix js tests under webpack

wheee regexes

spec/javascripts/jsx/speed_grader/mgpSpec.jsx was breaking :allthethings:
cuz 1. require and 2. multiline. now we allow those, cuz why not

test plan:
1. js specs should still pass under requirejs
2. js specs should now pass under webpack

Change-Id: I039991bcb8fd5afd25ffa1ede487bd3691848761
Reviewed-on: https://gerrit.instructure.com/91196
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
This commit is contained in:
Jon Jensen 2016-09-23 14:02:30 -06:00
parent 0913a186e9
commit c83c1ee93c
2 changed files with 6 additions and 6 deletions

View File

@ -7,14 +7,14 @@ module.exports = function(source){
var newSource = source; var newSource = source;
// add a qunit dependency to the dependency list // add a qunit dependency to the dependency list
newSource = newSource.replace(/define\(?\s*\[[^\]]/, function(match){ newSource = newSource.replace(/(define|require)\(?\s*\[[^\]]/, function(match){
return match.replace(/\[/, function(innerMatch){ return match.replace(/\[/, function(innerMatch){
return innerMatch + "'qunit',"; return innerMatch + "'qunit',";
}); });
}); });
// don't want the comma if the list is empty // don't want the comma if the list is empty
newSource = newSource.replace(/define\(?\s*\[\s*\]/, function(match){ newSource = newSource.replace(/(define|require)\(?\s*\[\s*\]/, function(match){
return match.replace(/\[/, function(innerMatch){ return match.replace(/\[/, function(innerMatch){
return innerMatch + "'qunit'"; return innerMatch + "'qunit'";
}); });

View File

@ -7,28 +7,28 @@ module.exports = function(source){
var newSource = source; var newSource = source;
// add a qunit dependency to the dependency list // add a qunit dependency to the dependency list
newSource = newSource.replace(/define\(?\s*\[[^\]]/, function(match){ newSource = newSource.replace(/(define|require)\(?\s*\[[^\]]/, function(match){
return match.replace(/\[/, function(innerMatch){ return match.replace(/\[/, function(innerMatch){
return innerMatch + "'qunit',"; return innerMatch + "'qunit',";
}); });
}); });
// don't want the comma if the list is empty // don't want the comma if the list is empty
newSource = newSource.replace(/define\(?\s*\[\s*\]/, function(match){ newSource = newSource.replace(/(define|require)\(?\s*\[\s*\]/, function(match){
return match.replace(/\[/, function(innerMatch){ return match.replace(/\[/, function(innerMatch){
return innerMatch + "'qunit'"; return innerMatch + "'qunit'";
}); });
}); });
// add a qunit reference in the AMD callback to capture the qunit dependency // add a qunit reference in the AMD callback to capture the qunit dependency
newSource = newSource.replace(/define[\s\S]*\],\s*\(.*\)\s*=>/, function(match){ newSource = newSource.replace(/(define|require)[\s\S]*\],\s*\([\s\S]+\)\s*=>/, function(match){
return match.replace(/\],\s*\(/, function(innerMatch){ return match.replace(/\],\s*\(/, function(innerMatch){
return innerMatch + "qunit,"; return innerMatch + "qunit,";
}); });
}); });
// don't want the comma if the list is empty // don't want the comma if the list is empty
newSource = newSource.replace(/define[\s\S]*\],\s*\(\s*\)\s*=>/, function(match){ newSource = newSource.replace(/(define|require)[\s\S]*\],\s*\(\s*\)\s*=>/, function(match){
return match.replace(/\],\s*\(/, function(innerMatch){ return match.replace(/\],\s*\(/, function(innerMatch){
return innerMatch + "qunit"; return innerMatch + "qunit";
}); });