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:
parent
0913a186e9
commit
c83c1ee93c
|
@ -7,14 +7,14 @@ module.exports = function(source){
|
|||
var newSource = source;
|
||||
|
||||
// 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 innerMatch + "'qunit',";
|
||||
});
|
||||
});
|
||||
|
||||
// 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 innerMatch + "'qunit'";
|
||||
});
|
||||
|
|
|
@ -7,28 +7,28 @@ module.exports = function(source){
|
|||
var newSource = source;
|
||||
|
||||
// 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 innerMatch + "'qunit',";
|
||||
});
|
||||
});
|
||||
|
||||
// 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 innerMatch + "'qunit'";
|
||||
});
|
||||
});
|
||||
|
||||
// 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 innerMatch + "qunit,";
|
||||
});
|
||||
});
|
||||
|
||||
// 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 innerMatch + "qunit";
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue